Serialize

Trait Serialize 

Source
pub trait Serialize {
    // Required method
    fn to_bytes(&self) -> &[u8];
}
Expand description

Trait for converting types to byte slices.

Enables serialization of structured data for transmission through queues or other byte-oriented communication channels.

§Examples

use osal_rs::os::ToBytes;
 
struct SensorData {
    temperature: i16,
    humidity: u8,
}
 
impl ToBytes for SensorData {
    fn to_bytes(&self) -> &[u8] {
        // Convert struct to bytes
    }
}

Required Methods§

Source

fn to_bytes(&self) -> &[u8]

Converts this value to a byte slice.

§Returns

A reference to the byte representation of this value

Implementors§