pub trait Readable: Sized {
// Required method
fn read_from(
reader: &mut (impl Read + ?Sized),
) -> Result<Self, ReadableError>;
}Expand description
Deserialize a value (possibly variable-length) from a Read source.
This is the more general counterpart to FixedReadable. Variable-length types such
as Vec<T>, String, HashMap, and Option<T> implement Readable directly.
Fixed-size types get a blanket impl that delegates to FixedReadable.
Prefer the extension method ReadValue::read_value over calling this trait directly.
§Errors
Returns ReadableError if the read fails or the bytes are not a valid encoding.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".