[−][src]Enum sequoia_openpgp::parse::PacketParserResult
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
impl<'a> PacketParserResult<'a>
[src]
pub fn is_eof(&self) -> bool
[src]
Returns true
if the result is EOF
.
pub fn is_some(&self) -> bool
[src]
Returns true
if the result is Some
.
pub fn expect(self, msg: &str) -> PacketParser<'a>ⓘNotable traits for PacketParser<'a>
impl<'a> Read for PacketParser<'a>
[src]
Notable traits for PacketParser<'a>
impl<'a> Read for PacketParser<'a>
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.
pub fn unwrap(self) -> PacketParser<'a>ⓘNotable traits for PacketParser<'a>
impl<'a> Read for PacketParser<'a>
[src]
Notable traits for PacketParser<'a>
impl<'a> Read for PacketParser<'a>
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.
pub fn as_ref(&self) -> StdResult<&PacketParser<'a>, &PacketParserEOF<'_>>
[src]
Converts from PacketParserResult
to Result<&PacketParser, &PacketParserEOF>
.
Produces a new Result
, containing references into the
original PacketParserResult
, leaving the original in place.
pub fn as_mut(
&mut self
) -> StdResult<&mut PacketParser<'a>, &mut PacketParserEOF<'a>>
[src]
&mut self
) -> StdResult<&mut PacketParser<'a>, &mut PacketParserEOF<'a>>
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.
pub fn take(&mut self) -> Self
[src]
Takes the value out of the PacketParserResult
, leaving a
EOF
in its place.
The EOF
left in place carries a PacketParserEOF
with
default values.
pub fn map<U, F>(self, f: F) -> StdResult<U, PacketParserEOF<'a>> where
F: FnOnce(PacketParser<'a>) -> U,
[src]
F: FnOnce(PacketParser<'a>) -> U,
Maps a PacketParserResult
to Result<PacketParser, PacketParserEOF>
by applying a function to a contained Some
value, leaving an EOF
value untouched.
Trait Implementations
impl<'a> Debug for PacketParserResult<'a>
[src]
impl<'a> From<PacketParserResult<'a>> for CertParser<'a>
[src]
pub fn from(ppr: PacketParserResult<'a>) -> Self
[src]
Initializes a CertParser
from a PacketParser
.
impl<'a> Parse<'a, PacketParserResult<'a>> for PacketParser<'a>
[src]
pub fn from_reader<R: Read + 'a + Send + Sync>(
reader: R
) -> Result<PacketParserResult<'a>>
[src]
reader: R
) -> Result<PacketParserResult<'a>>
Starts parsing an OpenPGP message stored in a std::io::Read
object.
This function returns a PacketParser
for the first packet in
the stream.
pub 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.
pub fn from_bytes<D: AsRef<[u8]> + ?Sized + Send + Sync>(
data: &'a D
) -> Result<PacketParserResult<'a>>
[src]
data: &'a D
) -> Result<PacketParserResult<'a>>
Starts parsing an OpenPGP message stored in a buffer.
This function returns a PacketParser
for the first packet in
the stream.
impl<'_> TryFrom<PacketParserResult<'_>> for Cert
[src]
type Error = Error
The type returned in the event of a conversion error.
pub fn try_from(ppr: PacketParserResult<'_>) -> Result<Self>
[src]
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.
impl<'a> TryFrom<PacketParserResult<'a>> for PacketPile
[src]
type Error = Error
The type returned in the event of a conversion error.
pub fn try_from(ppr: PacketParserResult<'a>) -> Result<PacketPile>
[src]
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.
Auto Trait Implementations
impl<'a> !RefUnwindSafe for PacketParserResult<'a>
[src]
impl<'a> Send for PacketParserResult<'a>
[src]
impl<'a> Sync for PacketParserResult<'a>
[src]
impl<'a> Unpin for PacketParserResult<'a>
[src]
impl<'a> !UnwindSafe for PacketParserResult<'a>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,