Skip to main content

RequestSerialize

Trait RequestSerialize 

Source
pub trait RequestSerialize: RequestCommon {
    // Provided methods
    fn serialize_request(&self) -> Vec<u8>  { ... }
    fn serialized_request_size(&self) -> usize { ... }
    fn deserialize_request(buffer: &[u8]) -> Result<Self, DeserializeError> { ... }
}

Provided Methods§

Source

fn serialize_request(&self) -> Vec<u8>

Serializes a request. A serialized request is composed of:

  • A variable sized integer for the Type ID of the request
  • Serialized content of the inner type.
Source

fn serialized_request_size(&self) -> usize

Computes the size in bytes of a serialized request. A serialized request is composed of:

  • A 2 bytes (u16) for the Type ID of the request
  • Serialized content of the inner type.
Source

fn deserialize_request(buffer: &[u8]) -> Result<Self, DeserializeError>

Deserializes a request A serialized request is composed of:

  • A variable sized integer for the Type ID of the request
  • Serialized content of the inner type.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§