pub trait Parse: Sized {
type Error: Into<Error>;
// Required method
fn parse(bytes: PolicyCursor) -> Result<(Self, PolicyCursor), Self::Error>;
}
Expand description
A data structure that can be parsed as a part of a binary policy.
Required Associated Types§
Sourcetype Error: Into<Error>
type Error: Into<Error>
The type of error that may be returned from parse()
, usually ParseError
or
anyhow::Error
.
Required Methods§
Sourcefn parse(bytes: PolicyCursor) -> Result<(Self, PolicyCursor), Self::Error>
fn parse(bytes: PolicyCursor) -> Result<(Self, PolicyCursor), 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.