Trait Parse

Source
pub trait Parse<'a, T>: Sealed {
    // Required method
    fn from_buffered_reader<R>(reader: R) -> Result<T>
       where R: BufferedReader<Cookie> + 'a;

    // Provided methods
    fn from_reader<R: 'a + Read + Send + Sync>(reader: R) -> Result<T> { ... }
    fn from_file<P: AsRef<Path>>(path: P) -> Result<T> { ... }
    fn from_bytes<D: AsRef<[u8]> + ?Sized + Send + Sync>(
        data: &'a D,
    ) -> Result<T> { ... }
}
Expand description

Parsing of packets and related structures.

This is a uniform interface to parse packets, messages, keys, and related data structures.

§Sealed trait

This trait is sealed and cannot be implemented for types outside this crate. Therefore it can be extended in a non-breaking way. If you want to implement the trait inside the crate you also need to implement the seal::Sealed marker trait.

Required Methods§

Source

fn from_buffered_reader<R>(reader: R) -> Result<T>
where R: BufferedReader<Cookie> + 'a,

Reads from the given buffered reader.

Implementations of this function should be short. Ideally, they should hand of the reader to a private function erasing the readers type by invoking BufferedReader::into_boxed.

Provided Methods§

Source

fn from_reader<R: 'a + Read + Send + Sync>(reader: R) -> Result<T>

Reads from the given reader.

The default implementation just uses Parse::from_buffered_reader, but implementations can provide their own specialized version.

Source

fn from_file<P: AsRef<Path>>(path: P) -> Result<T>

Reads from the given file.

The default implementation just uses Parse::from_buffered_reader, but implementations can provide their own specialized version.

Source

fn from_bytes<D: AsRef<[u8]> + ?Sized + Send + Sync>(data: &'a D) -> Result<T>

Reads from the given slice.

The default implementation just uses Parse::from_buffered_reader, but implementations can provide their own specialized version.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a> Parse<'a, S2K> for S2K

Source§

impl<'a> Parse<'a, Packet> for Packet

Source§

impl<'a> Parse<'a, SEIP> for SEIP

Source§

impl<'a> Parse<'a, Signature> for Signature

Source§

impl<'a> Parse<'a, Key<UnspecifiedParts, UnspecifiedRole>> for Key<UnspecifiedParts, UnspecifiedRole>

Source§

impl<'a> Parse<'a, OnePassSig> for OnePassSig

Source§

impl<'a> Parse<'a, PKESK> for PKESK

Source§

impl<'a> Parse<'a, SKESK> for SKESK

Source§

impl<'a> Parse<'a, PacketParserResult<'a>> for PacketParser<'a>

Source§

impl<'a> Parse<'a, RawCert<'a>> for RawCert<'a>

Source§

impl<'a> Parse<'a, RawCertParser<'a>> for RawCertParser<'a>

Source§

impl<'a> Parse<'a, CertParser<'a>> for CertParser<'a>

Source§

impl<'a> Parse<'a, MPI> for MPI

Source§

impl<'a> Parse<'a, Header> for Header

Source§

impl<'a> Parse<'a, OnePassSig3> for OnePassSig3

Source§

impl<'a> Parse<'a, OnePassSig6> for OnePassSig6

Source§

impl<'a> Parse<'a, PKESK3> for PKESK3

Source§

impl<'a> Parse<'a, PKESK6> for PKESK6

Source§

impl<'a> Parse<'a, CompressedData> for CompressedData

Source§

impl<'a> Parse<'a, Literal> for Literal

Source§

impl<'a> Parse<'a, MDC> for MDC

Source§

impl<'a> Parse<'a, Marker> for Marker

Source§

impl<'a> Parse<'a, Padding> for Padding

Source§

impl<'a> Parse<'a, Trust> for Trust

Source§

impl<'a> Parse<'a, UserID> for UserID

Source§

impl<'a> Parse<'a, UserAttribute> for UserAttribute

Source§

impl<'a> Parse<'a, Cert> for Cert

Source§

impl<'a> Parse<'a, Message> for Message

Source§

impl<'a> Parse<'a, PacketPile> for PacketPile

Source§

impl<'a> Parse<'a, DecryptorBuilder<'a>> for DecryptorBuilder<'a>

Source§

impl<'a> Parse<'a, DetachedVerifierBuilder<'a>> for DetachedVerifierBuilder<'a>

Source§

impl<'a> Parse<'a, VerifierBuilder<'a>> for VerifierBuilder<'a>

Source§

impl<'a> Parse<'a, PacketParserBuilder<'a>> for PacketParserBuilder<'a>

Source§

impl<'a> Parse<'a, PacketPileParser<'a>> for PacketPileParser<'a>