Skip to main content

KnetTransform

Trait KnetTransform 

Source
pub trait KnetTransform: Copy + Sized {
    // Required methods
    fn serialize(&self) -> Vec<u8> ;
    fn deserialize(&mut self, _: &[u8]);
    fn get_size_of_payload() -> usize;
    fn get_size_of_data(data: &[u8]) -> usize;
    fn from_raw(_: &[u8]) -> Self;
}

Required Methods§

Source

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

Serialize the data into a vector of byte

Source

fn deserialize(&mut self, _: &[u8])

Deserialize the data into a vector of byte

Source

fn get_size_of_payload() -> usize

Get the size of the payload of the serialize data

Source

fn get_size_of_data(data: &[u8]) -> usize

Get size of the data followed by the payload Note the data have to be the same size as the get_size_of_payload function

Source

fn from_raw(_: &[u8]) -> Self

Create Self by the vector of byte

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§