pub trait FromRaw<R, A>: Sized {
type Error;
// Required method
fn try_from_raw_with(raw: R, args: A) -> Result<Self, Self::Error>;
// Provided method
fn try_from_raw(raw: R) -> Result<Self, <Self as FromRaw<R, A>>::Error>
where Self: FromRaw<R, (), Error = <Self as FromRaw<R, A>>::Error> { ... }
}
Expand description
A packet that can be created from a raw form.
FromRaw
provides a common interface for packets that can be created from
an “unchecked” form - that is, that are parsed raw without any higher-order
validation.
The type parameter R
is the raw type that the FromRaw
type can be
converted from, given some arguments of type A
.
Required Associated Types§
Required Methods§
Sourcefn try_from_raw_with(raw: R, args: A) -> Result<Self, Self::Error>
fn try_from_raw_with(raw: R, args: A) -> Result<Self, Self::Error>
Attempts to create Self
from the raw form in raw
with args
.
Provided Methods§
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.