pub struct PendingMessageQueue { /* private fields */ }Expand description
A FIFO of AgentMessages waiting to be injected at a drain point. Mirrors
TS PendingMessageQueue. Clone so Agent can keep a steering instance
and a follow-up instance independently.
Implementations§
Source§impl PendingMessageQueue
impl PendingMessageQueue
pub fn new(mode: QueueMode) -> Self
pub fn mode(&self) -> QueueMode
Sourcepub fn enqueue(&mut self, message: AgentMessage)
pub fn enqueue(&mut self, message: AgentMessage)
Append a message to the tail. Mirrors TS enqueue.
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Sourcepub fn try_drain(&mut self) -> Vec<AgentMessage>
pub fn try_drain(&mut self) -> Vec<AgentMessage>
Drain queued messages per QueueMode:
All: return and remove every queued message, in enqueue order.OneAtATime: return and remove only the oldest, leaving the rest.
Returns an empty Vec when nothing is queued (the loop treats an empty
drain as “no injection”). Mirrors TS tryDrain.
Trait Implementations§
Source§impl Clone for PendingMessageQueue
impl Clone for PendingMessageQueue
Source§fn clone(&self) -> PendingMessageQueue
fn clone(&self) -> PendingMessageQueue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PendingMessageQueue
impl Debug for PendingMessageQueue
Source§impl Default for PendingMessageQueue
impl Default for PendingMessageQueue
Source§fn default() -> PendingMessageQueue
fn default() -> PendingMessageQueue
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PendingMessageQueue
impl RefUnwindSafe for PendingMessageQueue
impl Send for PendingMessageQueue
impl Sync for PendingMessageQueue
impl Unpin for PendingMessageQueue
impl UnsafeUnpin for PendingMessageQueue
impl UnwindSafe for PendingMessageQueue
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