Skip to main content

Bytesable

Trait Bytesable 

Source
pub trait Bytesable {
    // Required methods
    fn from_bytes(bytes: Bytes) -> Self;
    fn length_in_bytes(&self) -> usize;
    fn into_bytes<W>(&self, writer: &mut W)
       where W: Write;
}
Expand description

A type that can be serialized and deserialized through Bytes.

Required Methods§

Source

fn from_bytes(bytes: Bytes) -> Self

Wrap bytes as Self.

Source

fn length_in_bytes(&self) -> usize

The number of bytes required to serialize the data.

Source

fn into_bytes<W>(&self, writer: &mut W)
where W: Write,

Writes the binary representation into writer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, C> Bytesable for Message<T, C>
where T: Serialize + for<'a> Deserialize<'a>, C: ContainerBytes,

Source§

impl<T: Data> Bytesable for Bincode<T>