pub trait Node {
type Value;
// Required methods
fn write_value<W>(writer: &mut W, value: &Self::Value) -> Result<usize>
where W: Write;
fn read_value(bytes: &[u8]) -> (usize, Self::Value);
}
Expand description
TreeVec
is generic over the value types associated with each node. Furthermore it is also
generic about the way these are serialized. E.g. A value type of i64
could be stored in
little endian, big endian or a bitpacked representation. This allows us to adapt the tree to a
wide variaty of usecases.
Required Associated Types§
Required Methods§
Sourcefn write_value<W>(writer: &mut W, value: &Self::Value) -> Result<usize>where
W: Write,
fn write_value<W>(writer: &mut W, value: &Self::Value) -> Result<usize>where
W: Write,
Writes the value, so Self::read_value
can extract it again. In case of success the
number of bytes written is returned.
Sourcefn read_value(bytes: &[u8]) -> (usize, Self::Value)
fn read_value(bytes: &[u8]) -> (usize, Self::Value)
Reads the value from a raw binary representation. Reads the value from the back of the passed slice.
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.