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", so this trait is not object safe.

Implementors§

Source§

impl Parse for MlsLevel

Temporary adapter implementing legacy policy Parse trait by delegating to new_policy trait during migration.

Source§

impl Parse for MlsRange

Temporary adapter implementing legacy policy Parse trait by delegating to new_policy trait during migration.

Source§

impl<T: Clone + Debug + FromBytes + KnownLayout + Immutable + PartialEq + Unaligned> Parse for T