pub trait BincodeRead<'storage>: Read {
// Required methods
fn forward_read_str<V>(
&mut self,
length: usize,
visitor: V,
) -> Result<V::Value>
where V: Visitor<'storage>;
fn get_byte_buffer(&mut self, length: usize) -> Result<Vec<u8>>;
fn forward_read_bytes<V>(
&mut self,
length: usize,
visitor: V,
) -> Result<V::Value>
where V: Visitor<'storage>;
}
Expand description
An optional Read trait for advanced Bincode usage.
It is highly recommended to use bincode with io::Read
or &[u8]
before
implementing a custom BincodeRead
.
The forward_read_* methods are necessary because some byte sources want to pass a long-lived borrow to the visitor and others want to pass a transient slice.
Required Methods§
Sourcefn forward_read_str<V>(&mut self, length: usize, visitor: V) -> Result<V::Value>where
V: Visitor<'storage>,
fn forward_read_str<V>(&mut self, length: usize, visitor: V) -> Result<V::Value>where
V: Visitor<'storage>,
Check that the next length
bytes are a valid string and pass
it on to the serde reader.
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.