kinesin_rdt::frame

Trait Serialize

Source
pub trait Serialize {
    // Required methods
    fn serialized_length(&self) -> usize;
    fn write(&self, buf: &mut [u8]) -> usize;
    fn read(buf: &[u8]) -> Result<(usize, Self), ()>
       where Self: Sized;

    // Provided method
    fn has_end_optimization() -> bool
       where Self: Sized { ... }
}
Expand description

frame serialization

Required Methods§

Source

fn serialized_length(&self) -> usize

determine serialized length of frame

Source

fn write(&self, buf: &mut [u8]) -> usize

write frame to buffer, returning serialized length

Source

fn read(buf: &[u8]) -> Result<(usize, Self), ()>
where Self: Sized,

read frame from buffer, returning frame and serialized length

Provided Methods§

Source

fn has_end_optimization() -> bool
where Self: Sized,

whether the frame has special “serialize to end” behavior

Implementors§