/// 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. pubtrait BincodeRead<'storage>: io::Read { /// Check that the next `length` bytes are a valid string and pass /// it on to the serde reader. fn forward_read_str<V>(&mutself, length: usize, visitor: V) -> Result<V::Value> where
V: serde::de::Visitor<'storage>;
/// Transfer ownership of the next `length` bytes to the caller. fn get_byte_buffer(&mutself, length: usize) -> Result<Vec<u8>>;
/// Pass a slice of the next `length` bytes on to the serde reader. fn forward_read_bytes<V>(&mutself, length: usize, visitor: V) -> Result<V::Value> where
V: serde::de::Visitor<'storage>;
}
/// A BincodeRead implementation for byte slices pubstruct SliceReader<'storage> {
slice: &'storage [u8],
}
/// A BincodeRead implementation for `io::Read`ers pubstruct IoReader<R> {
reader: R,
temp_buffer: Vec<u8>,
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.