flood_rs

Trait BufferSerializer

source
pub trait BufferSerializer: Sized {
    // Required method
    fn serialize(&self, buf: &mut &[u8]) -> Result<usize>;
}
Expand description

A trait for serializing objects to an octet buffer.

Required Methods§

source

fn serialize(&self, buf: &mut &[u8]) -> Result<usize>

Serializes self into the given mutable octet buffer.

§Parameters
  • buf: A mutable reference to a octet slice that will be populated with serialized data.
§Returns

This method returns a Result<usize>, which is:

  • Ok(usize) representing the number of octets written to the buffer on success.
  • Err(io::Error) if serialization fails, which could occur due to issues with writing to the buffer.

Object Safety§

This trait is not object safe.

Implementors§