[−][src]Trait geng_core::prelude::bincode::BincodeRead
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
fn forward_read_str<V>(
&mut self,
length: usize,
visitor: V
) -> Result<<V as Visitor<'storage>>::Value, Box<ErrorKind>> where
V: Visitor<'storage>,
&mut self,
length: usize,
visitor: V
) -> Result<<V as Visitor<'storage>>::Value, Box<ErrorKind>> where
V: Visitor<'storage>,
Check that the next length
bytes are a valid string and pass
it on to the serde reader.
fn get_byte_buffer(&mut self, length: usize) -> Result<Vec<u8>, Box<ErrorKind>>
Transfer ownership of the next length
bytes to the caller.
fn forward_read_bytes<V>(
&mut self,
length: usize,
visitor: V
) -> Result<<V as Visitor<'storage>>::Value, Box<ErrorKind>> where
V: Visitor<'storage>,
&mut self,
length: usize,
visitor: V
) -> Result<<V as Visitor<'storage>>::Value, Box<ErrorKind>> where
V: Visitor<'storage>,
Pass a slice of the next length
bytes on to the serde reader.
Implementors
impl<'a, R> BincodeRead<'a> for IoReader<R> where
R: Read,
[src]
R: Read,
fn forward_read_str<V>(
&mut self,
length: usize,
visitor: V
) -> Result<<V as Visitor<'a>>::Value, Box<ErrorKind>> where
V: Visitor<'a>,
[src]
&mut self,
length: usize,
visitor: V
) -> Result<<V as Visitor<'a>>::Value, Box<ErrorKind>> where
V: Visitor<'a>,
fn get_byte_buffer(&mut self, length: usize) -> Result<Vec<u8>, Box<ErrorKind>>
[src]
fn forward_read_bytes<V>(
&mut self,
length: usize,
visitor: V
) -> Result<<V as Visitor<'a>>::Value, Box<ErrorKind>> where
V: Visitor<'a>,
[src]
&mut self,
length: usize,
visitor: V
) -> Result<<V as Visitor<'a>>::Value, Box<ErrorKind>> where
V: Visitor<'a>,
impl<'storage> BincodeRead<'storage> for SliceReader<'storage>
[src]
fn forward_read_str<V>(
&mut self,
length: usize,
visitor: V
) -> Result<<V as Visitor<'storage>>::Value, Box<ErrorKind>> where
V: Visitor<'storage>,
[src]
&mut self,
length: usize,
visitor: V
) -> Result<<V as Visitor<'storage>>::Value, Box<ErrorKind>> where
V: Visitor<'storage>,
fn get_byte_buffer(&mut self, length: usize) -> Result<Vec<u8>, Box<ErrorKind>>
[src]
fn forward_read_bytes<V>(
&mut self,
length: usize,
visitor: V
) -> Result<<V as Visitor<'storage>>::Value, Box<ErrorKind>> where
V: Visitor<'storage>,
[src]
&mut self,
length: usize,
visitor: V
) -> Result<<V as Visitor<'storage>>::Value, Box<ErrorKind>> where
V: Visitor<'storage>,