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
}
}