[][src]Enum sequoia_openpgp::parse::PacketParserResult

pub enum PacketParserResult<'a> {
    Some(PacketParser<'a>),
    EOF(PacketParserEOF),
}

The return type of PacketParser::next() and PacketParser::recurse().

We don't use an Option, because when we reach the end of the packet sequence, some information about the message needs to remain accessible.

Variants

Some(PacketParser<'a>)

A PacketParser for the next packet.

EOF(PacketParserEOF)

Information about a fully parsed packet sequence.

Methods

impl<'a> PacketParserResult<'a>[src]

pub fn is_none(&self) -> bool[src]

Like Option::is_none().

pub fn is_eof(&self) -> bool[src]

An alias for is_none().

pub fn is_some(&self) -> bool[src]

Like Option::is_some().

Important traits for PacketParser<'a>
pub fn expect(self, msg: &str) -> PacketParser<'a>[src]

Like Option::expect().

Important traits for PacketParser<'a>
pub fn unwrap(self) -> PacketParser<'a>[src]

Like Option::unwrap().

pub fn as_ref(&self) -> Option<&PacketParser<'a>>[src]

Like Option::as_ref().

pub fn as_mut(&mut self) -> Option<&mut PacketParser<'a>>[src]

Like Option::as_mut().

pub fn take(&mut self) -> Self[src]

Like Option::take().

self is replaced with a PacketParserEOF with default values.

pub fn map<U, F>(self, f: F) -> Option<U> where
    F: FnOnce(PacketParser<'a>) -> U, 
[src]

Like Option::map().

pub fn recursion_depth(&self) -> Option<isize>[src]

The current packet's recursion depth.

A top-level packet has a recursion depth of 0. Packets in a top-level container have a recursion depth of 1, etc.

Note: if the PacketParser has reached the end of the packet sequence and is not parsing a packet, then this returns None.

pub fn last_recursion_depth(&self) -> Option<isize>[src]

The last packet's recursion depth.

A top-level packet has a recursion depth of 0. Packets in a top-level container have a recursion depth of 1, etc.

Note: if no packet has been returned yet, this returns None.

Trait Implementations

impl<'a> Parse<'a, PacketParserResult<'a>> for PacketParser<'a>[src]

fn from_reader<R: Read + 'a>(reader: R) -> Result<PacketParserResult<'a>>[src]

Starts parsing an OpenPGP message stored in a std::io::Read object.

This function returns a PacketParser for the first packet in the stream.

fn from_file<P: AsRef<Path>>(path: P) -> Result<PacketParserResult<'a>>[src]

Starts parsing an OpenPGP message stored in a file named path.

This function returns a PacketParser for the first packet in the stream.

fn from_bytes(bytes: &'a [u8]) -> Result<PacketParserResult<'a>>[src]

Starts parsing an OpenPGP message stored in a buffer.

This function returns a PacketParser for the first packet in the stream.

impl<'a> Debug for PacketParserResult<'a>[src]

Auto Trait Implementations

impl<'a> !Send for PacketParserResult<'a>

impl<'a> !Sync for PacketParserResult<'a>

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.