Skip to main content

Parse

Trait Parse 

Source
pub trait Parse: Sized {
    type Error: Into<Error>;

    // Required method
    fn parse<'a>(
        bytes: PolicyCursor<'a>,
    ) -> Result<(Self, PolicyCursor<'a>), Self::Error>;
}
Expand description

A data structure that can be parsed as a part of a binary policy.

Required Associated Types§

Source

type Error: Into<Error>

The type of error that may be returned from parse(), usually [ParseError] or anyhow::Error.

Required Methods§

Source

fn parse<'a>( bytes: PolicyCursor<'a>, ) -> Result<(Self, PolicyCursor<'a>), Self::Error>

Parses a Self from bytes, returning the Self and trailing bytes, or an error if bytes corresponding to a Self are malformed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Parse for U32

Treat a type as metadata that contains a count of subsequent data.

Source§

type Error = Error

Source§

fn parse<'a>( bytes: PolicyCursor<'a>, ) -> Result<(Self, PolicyCursor<'a>), Self::Error>

Implementors§

Source§

impl<T: Parse> Parse for T