Skip to main content

Inboxes

Struct Inboxes 

Source
pub struct Inboxes { /* private fields */ }
Expand description

Every print’s inbox, and the signal an arrival raises.

Implementations§

Source§

impl Inboxes

Source

pub fn turns_ended(&self, print_id: PrintId) -> u64

How many times the print’s turn has been released so far: what Inboxes::claim_if_idle_since is handed, read before the caller waits on anything a turn’s end may start.

Source

pub fn claim_or_hand_over(&self, print_id: PrintId, arrival: Arrival) -> bool

Claim the print’s turn for this arrival, or hand it to the turn already running.

Answers true when the caller now holds the print’s turn and must run it, and false when the arrival was handed to a turn already running.

Source

pub fn claim_if_idle(&self, print_id: PrintId) -> bool

Claim the print’s turn only when nothing holds it.

Answers true when the caller now holds the print’s turn and must run it, and false — handing nothing over — when a turn is already running for it. What the periodic observation claims with: an observation is owed to a print nobody is watching, and one queued behind a running turn would only pile up beside what that turn is already looking at.

Source

pub fn claim_if_idle_since(&self, print_id: PrintId, seen: u64) -> bool

Inboxes::claim_if_idle, refused too when a turn of the print has ended since Inboxes::turns_ended answered seen.

What the periodic observation claims with: it waits for the port’s idle work before it claims, and a turn that ended after that wait may have started idle work the wait never saw, which the observation’s own turn would then cancel. Refused, it is the next round’s, which waits for it.

Source

pub fn next_or_release(&self, print_id: PrintId) -> Option<Vec<Arrival>>

What the turn that just returned never took, oldest first, or — when it took everything — nothing, with the print’s turn released.

Source

pub fn put_back(&self, print_id: PrintId, taken: Vec<Arrival>)

Hand what a look took back to the print’s running turn, ahead of anything that arrived since, because the look that took it delivered nothing.

A print with no turn running any more has nothing to hand it to: its turn released it, and what was waiting went with it.

Source

pub fn release(&self, print_id: PrintId)

Release the print’s turn, dropping anything still waiting for it.

For a print that has ended: nothing waiting for it can be acted on.

Source

pub fn wait_and_take(&self, print_id: PrintId, wait: Duration) -> Vec<Arrival>

Wait up to wait for anything to be handed to the print’s running turn, and take it.

Answers at once when something is already waiting, and answers nothing after the whole wait when nothing arrives. A print with no turn running has nothing handed to it, because an event for it claims a turn of its own instead; a look at it simply waits.

Trait Implementations§

Source§

impl Debug for Inboxes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Inboxes

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for Inboxes

§

impl Forget for Inboxes

§

impl Move for Inboxes

§

impl RefUnwindSafe for Inboxes

§

impl Send for Inboxes
where Mutex<State>: Send, Atomic<u32>: Send,

§

impl Sync for Inboxes
where Mutex<State>: Sync, Atomic<u32>: Sync,

§

impl Unpin for Inboxes
where Align4<u32>: Unpin, Align1<u8>: Unpin, *const LeafNode<PrintId, Inbox> is !null: Unpin, Box<(PrintId, Inbox)>: Unpin, *const LeafNode<PrintId, u64> is !null: Unpin, Box<(PrintId, u64)>: Unpin,

§

impl UnsafeUnpin for Inboxes
where Align4<u32>: UnsafeUnpin, Align1<u8>: UnsafeUnpin, *const LeafNode<PrintId, Inbox> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(PrintId, Inbox)>>: UnsafeUnpin, *const LeafNode<PrintId, u64> is !null: UnsafeUnpin, PhantomData<Box<(PrintId, u64)>>: UnsafeUnpin,

§

impl UnwindSafe for Inboxes

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.