pub struct InputMailbox { /* private fields */ }Expand description
Thread-safe FIFO input storage with target-selective atomic claims.
§Panics
Every method here propagates a poisoned queue lock rather than recovering it,
per the crate-level lock-poisoning contract. Nothing a
caller passes can cause that: the queue holds owned InputBatch values and
no foreign code runs under the lock.
Implementations§
Source§impl InputMailbox
impl InputMailbox
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates an empty mailbox attached to no Session.
This is for a composition layer assembling its own queue — a test double,
or a staging buffer drained into a real inbox later. It is not how you
reach a running Run: Session::input_mailbox returns a handle onto the
Session’s own queue, and a mailbox built here shares nothing with it, so
pushing to one succeeds and is never claimed by anybody.
Sourcepub fn push(&self, batch: InputBatch)
pub fn push(&self, batch: InputBatch)
Moves one already-frozen owned batch into global FIFO order.
§Panics
If the queue lock is poisoned, as the mailbox’s panic conditions describe.
Sourcepub fn claim(&self, target: InputTarget) -> Option<InputBatch>
pub fn claim(&self, target: InputTarget) -> Option<InputBatch>
Atomically removes the oldest batch for target without reordering peers.
§Panics
If the queue lock is poisoned, as the mailbox’s panic conditions describe.
Sourcepub fn drain(&self) -> Vec<InputBatch>
pub fn drain(&self) -> Vec<InputBatch>
Atomically removes every currently queued batch in FIFO order.
§Panics
If the queue lock is poisoned, as the mailbox’s panic conditions describe.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of queued batches at one lock linearization point.
§Panics
If the queue lock is poisoned, as the mailbox’s panic conditions describe.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Reports whether the mailbox is empty at one lock linearization point.
§Panics
If the queue lock is poisoned, as the mailbox’s panic conditions describe.
Trait Implementations§
Source§impl Clone for InputMailbox
impl Clone for InputMailbox
Source§impl Debug for InputMailbox
impl Debug for InputMailbox
Source§fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
Reports the queue depth at one non-blocking observation.
The mailbox is the session’s only concurrent write entry point, so a formatter that waited for the queue lock could stall the very producer it is describing. On contention it says so rather than guessing.