pub trait Unpacker: Sized {
// Required method
fn unpack(reader: &mut Bytes) -> Result<Self>;
}Expand description
Trait for types that can be unpacked from a compact binary format.
This trait provides compact deserialization without schema evolution support. Use this when you need maximum performance and don’t require forward/backward compatibility.
§Errors
Returns EncoderError if the value cannot be unpacked or the data is invalid.
Required Methods§
Sourcefn unpack(reader: &mut Bytes) -> Result<Self>
fn unpack(reader: &mut Bytes) -> Result<Self>
Unpack the value from the given buffer without schema evolution support.
This method reads data from a compact format without field IDs or type tags. The format is not schema-evolution-friendly but offers better performance.
§Arguments
reader- The buffer to read the packed bytes from.
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.
Implementations on Foreign Types§
Source§impl Unpacker for bool
Unpacks a bool from a single byte with relaxed validation.
impl Unpacker for bool
Unpacks a bool from a single byte with relaxed validation.
0 is interpreted as false, any non-zero value is interpreted as true.
No error checking is performed for invalid values.