pub struct AgentMailbox { /* private fields */ }Expand description
A per-agent inbox for receiving messages.
Wraps a Vec<AgentMessage> behind an Arc<Mutex<_>> so it can be shared
between the agent owner and any senders.
Implementations§
Source§impl AgentMailbox
impl AgentMailbox
Sourcepub fn send(&self, message: AgentMessage)
pub fn send(&self, message: AgentMessage)
Push a message into the mailbox.
Sourcepub fn drain(&self) -> Vec<AgentMessage>
pub fn drain(&self) -> Vec<AgentMessage>
Take all pending messages, leaving the mailbox empty.
Sourcepub fn has_messages(&self) -> bool
pub fn has_messages(&self) -> bool
Whether the mailbox has pending messages.
Trait Implementations§
Source§impl Clone for AgentMailbox
impl Clone for AgentMailbox
Source§fn clone(&self) -> AgentMailbox
fn clone(&self) -> AgentMailbox
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AgentMailbox
impl RefUnwindSafe for AgentMailbox
impl Send for AgentMailbox
impl Sync for AgentMailbox
impl Unpin for AgentMailbox
impl UnsafeUnpin for AgentMailbox
impl UnwindSafe for AgentMailbox
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