pub trait LengthReadablewhere
Self: Sized,{
// Required method
fn read_from_fixed_length_buffer<R: LengthLimitedRead>(
reader: &mut R,
) -> Result<Self, DecodeError>;
}Expand description
A trait that allows the implementer to be read in from a LengthLimitedRead, requiring the
reader to limit the number of total bytes read from its underlying Read. Useful for structs
that will always consume the entire provided Read when deserializing.
Any type that implements Readable also automatically has a LengthReadable
implementation, but some types, most notably onion packets, only implement LengthReadable.
This is not exported to bindings users as reads are always from byte arrays, never streams, in bindings.
Required Methods§
Sourcefn read_from_fixed_length_buffer<R: LengthLimitedRead>(
reader: &mut R,
) -> Result<Self, DecodeError>
fn read_from_fixed_length_buffer<R: LengthLimitedRead>( reader: &mut R, ) -> Result<Self, DecodeError>
Reads a Self in from the given LengthLimitedRead.
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.