Record

Trait Record 

Source
pub trait Record<'raw>: SubRecord<'raw> {
    const OPCODE: Option<u32> = None;

    // Provided methods
    fn deserialize(raw: &'raw [u8]) -> DeResult<Self> { ... }
    fn serialize<W: Write>(&self, dest: &mut W) -> SeResult<usize> { ... }
}
Expand description

Bebop message type which can be serialized and deserialized.

Provided Associated Constants§

Source

const OPCODE: Option<u32> = None

Provided Methods§

Source

fn deserialize(raw: &'raw [u8]) -> DeResult<Self>

Deserialize this record

Source

fn serialize<W: Write>(&self, dest: &mut W) -> SeResult<usize>

Serialize this record. It is highly recommend to use a buffered writer.

§Example
// For fixed-size types
let value = MyFixedSizeType;
let mut buf = Vec::with_capacity(MyFixedSizeType::SERIALIZED_SIZE);
let bytes_written = value.serialize(&mut buf).unwrap();
// For variable-size types
let value = MyVariableSizeType;
let size = value.serialized_size();
let mut buf = Vec::with_capacity(size);
let bytes_written = value.serialize(&mut buf).unwrap();

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.

Implementors§