Skip to main content

Queue

Trait Queue 

Source
pub trait Queue {
    // Required methods
    fn next(&mut self) -> Result<Option<Unit>, LoopError>;
    fn close(
        &mut self,
        unit: &Unit,
        evidence: &Evidence,
    ) -> Result<CloseOutcome, LoopError>;
}
Expand description

Source of work units. Each call to next either returns the next unit to dispatch or None to signal that the walk is complete.

§Why &mut self (F8 rationale)

A Queue can carry real cursor state. Using &self would force pointless Mutex-wrapping for state that is inherently sequential in the single-threaded walk loop. No threading requirement exists at this seam: run_loop is always called from a single thread. &mut self is the natural fit and avoids unnecessary interior-mutability noise.

Required Methods§

Source

fn next(&mut self) -> Result<Option<Unit>, LoopError>

Return the next unit, or None if the queue is empty.

Source

fn close( &mut self, unit: &Unit, evidence: &Evidence, ) -> Result<CloseOutcome, LoopError>

Mark a unit as closed (done/parked/refused) given the termination evidence extracted from the journal.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§