pub trait Message: Sized + Schema {
// Provided methods
fn to_bytes(&self) -> Vec<u8> ⓘ { ... }
fn from_bytes(bytes: &[u8]) -> Option<Self> { ... }
fn with_bytes<R>(&self, f: impl FnOnce(&[u8]) -> R) -> R { ... }
}Expand description
A message the bus carries; its payload is Self as a frame
(yog_data::frame: packed by position — both sides have the schema).
Provided Methods§
Sourcefn from_bytes(bytes: &[u8]) -> Option<Self>
fn from_bytes(bytes: &[u8]) -> Option<Self>
The message read from a payload; None if it isn’t one.
Sourcefn with_bytes<R>(&self, f: impl FnOnce(&[u8]) -> R) -> R
fn with_bytes<R>(&self, f: impl FnOnce(&[u8]) -> R) -> R
f on the payload, packed in this thread’s reused buffers: nothing
allocated once they’ve grown to the thread’s messages.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".