pub trait FromBytes<'a> {
// Required method
fn from_bytes(bytes: &mut impl Iterator<Item = &'a [u8]>) -> Self;
}
Expand description
A type that can be reconstituted from byte slices with lifetime 'a
.
Implementors of this trait almost certainly reference the lifetime 'a
themselves,
unless they actively deserialize the bytes (vs sit on the slices, as if zero-copy).
Required Methods§
sourcefn from_bytes(bytes: &mut impl Iterator<Item = &'a [u8]>) -> Self
fn from_bytes(bytes: &mut impl Iterator<Item = &'a [u8]>) -> Self
Reconstructs self
from a sequence of correctly aligned and sized bytes slices.
The implementation is expected to consume the right number of items from the iterator,
which may go on to be used by other implementations of FromBytes
.
Object Safety§
This trait is not object safe.