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

The result of parsing a packet.

This type is returned by PacketParser::next, PacketParser::recurse, PacketParserBuilder::build, and the implementation of PacketParser’s Parse trait. The result is either Some(PacketParser), indicating successful parsing of a packet, or EOF(PacketParserEOF) if the end of the input stream has been reached.

Variants

Some(PacketParser<'a>)

A PacketParser for the next packet.

EOF(PacketParserEOF<'a>)

Information about a fully parsed packet sequence.

Implementations

Returns true if the result is EOF.

Returns true if the result is Some.

Unwraps a result, yielding the content of an Some.

Panics

Panics if the value is an EOF, with a panic message including the passed message, and the information in the PacketParserEOF object.

Unwraps a result, yielding the content of an Some.

Panics

Panics if the value is an EOF, with a panic message including the information in the PacketParserEOF object.

Converts from PacketParserResult to Result<&PacketParser, &PacketParserEOF>.

Produces a new Result, containing references into the original PacketParserResult, leaving the original in place.

Converts from PacketParserResult to Result<&mut PacketParser, &mut PacketParserEOF>.

Produces a new Result, containing mutable references into the original PacketParserResult, leaving the original in place.

Takes the value out of the PacketParserResult, leaving a EOF in its place.

The EOF left in place carries a PacketParserEOF with default values.

Maps a PacketParserResult to Result<PacketParser, PacketParserEOF> by applying a function to a contained Some value, leaving an EOF value untouched.

Trait Implementations

Formats the value using the given formatter. Read more

Initializes a CertParser from a PacketParser.

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

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

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

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

Starts parsing an OpenPGP message stored in a buffer.

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

Returns the Cert found in the packet stream.

If the sequence contains multiple certificates (i.e., it is a keyring), or the certificate is followed by an invalid packet this function will fail. To parse keyrings, use CertParser instead of this function.

The type returned in the event of a conversion error.

Reads all of the packets from a PacketParser, and turns them into a message.

Note: this assumes that ppr points to a top-level packet.

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.