pub struct MessageBus { /* private fields */ }Expand description
Message bus for inter-slot communication.
Implements a simple inbox-based messaging system where each slot has a queue of messages addressed to it.
Implementations§
Source§impl MessageBus
impl MessageBus
Sourcepub fn send(&self, from: SlotId, to: SlotId, content: String) -> String
pub fn send(&self, from: SlotId, to: SlotId, content: String) -> String
Send a message from one slot to another, returning the message ID.
Sourcepub fn read(&self, slot_id: &SlotId) -> Vec<Message>
pub fn read(&self, slot_id: &SlotId) -> Vec<Message>
Read and drain all messages for a slot, returning them in order.
Sourcepub fn peek(&self, slot_id: &SlotId) -> Vec<Message>
pub fn peek(&self, slot_id: &SlotId) -> Vec<Message>
Peek at all messages for a slot without removing them.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MessageBus
impl !RefUnwindSafe for MessageBus
impl Send for MessageBus
impl Sync for MessageBus
impl Unpin for MessageBus
impl UnsafeUnpin for MessageBus
impl UnwindSafe for MessageBus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more