Skip to main content

Message

Trait Message 

Source
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§

Source

fn to_bytes(&self) -> Vec<u8> ⓘ

The payload’s bytes.

Source

fn from_bytes(bytes: &[u8]) -> Option<Self>

The message read from a payload; None if it isn’t one.

Source

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".

Implementors§

Source§

impl<T> Message for T
where T: Schema,