Skip to main content

PumpedDelivery

Struct PumpedDelivery 

Source
pub struct PumpedDelivery<E, Bk, C, K>
where E: EpochId + 'static, Bk: IoBackend, K: StampClock,
{ /* private fields */ }
Expand description

The engine, drained by the consumer’s own thread when it calls pump.

Implementations§

Source§

impl<E, Bk, C, K> PumpedDelivery<E, Bk, C, K>
where E: EpochId + 'static, Bk: IoBackend, <Bk as IoBackend>::Notification: Waitable, K: StampClock,

Source

pub fn new( engine: Engine<E, Bk, C, K>, ) -> Result<PumpedDelivery<E, Bk, C, K>, (Error, Box<Engine<E, Bk, C, K>>)>

Deliver engine to whoever pumps.

§Errors

The backend’s, with the engine handed back: it could not make its notification.

Source

pub fn with_notification( engine: Engine<E, Bk, C, K>, notification: <Bk as IoBackend>::Notification, ) -> PumpedDelivery<E, Bk, C, K>

Deliver engine, waiting on notification – not the backend’s own – when a pump waits. For a delivery whose waker is something else, which signals notification itself.

Source

pub fn pump(&mut self, timeout: Option<Duration>) -> Pumped

Drain the backend to empty; if that delivered entries, return. Otherwise wait up to timeout for the notification and drain again. A wait that times out drains too: a drain of nothing is a no-op, and a zero timeout is the pump that does not wait.

Drained before it waits, as the notification being an edge requires (the ring crate’s D-19): the completions that raised it may already have been taken by a wait that was not this one – another handle on the same event – and waiting for a raising that has happened would block while they sit in the backend.

Returning does not promise entries: the wait may have been satisfied by a raising whose completions an earlier drain took, or by the setup signal the ring crate raises once (D-20).

Source§

impl<E, Bk, C, K> PumpedDelivery<E, Bk, C, K>
where E: EpochId + 'static, Bk: IoBackend, K: StampClock,

Source

pub fn engine(&self) -> EngineGuard<'_, Engine<E, Bk, C, K>>

The engine, locked: what a consumer call acts through.

Source

pub fn shared(&self) -> Arc<Mutex<Option<Engine<E, Bk, C, K>>>> ⓘ

The engine’s slot, for a path of the driver’s own that reaches it on another thread.

Source

pub fn into_engine(self) -> Engine<E, Bk, C, K>

Stop delivering, handing the engine back: it is taken out of its slot, so a shared path finds it empty.

Auto Trait Implementations§

§

impl<E, Bk, C, K> Freeze for PumpedDelivery<E, Bk, C, K>
where <Bk as IoBackend>::Notification: Freeze, Arc<Mutex<Option<Engine<E, Bk, C, K>>>>: Freeze,

§

impl<E, Bk, C, K> RefUnwindSafe for PumpedDelivery<E, Bk, C, K>

§

impl<E, Bk, C, K> Send for PumpedDelivery<E, Bk, C, K>
where <Bk as IoBackend>::Notification: Send, Arc<Mutex<Option<Engine<E, Bk, C, K>>>>: Send,

§

impl<E, Bk, C, K> Sync for PumpedDelivery<E, Bk, C, K>
where <Bk as IoBackend>::Notification: Sync, Arc<Mutex<Option<Engine<E, Bk, C, K>>>>: Sync,

§

impl<E, Bk, C, K> Unpin for PumpedDelivery<E, Bk, C, K>
where <Bk as IoBackend>::Notification: Unpin, Arc<Mutex<Option<Engine<E, Bk, C, K>>>>: Unpin,

§

impl<E, Bk, C, K> UnsafeUnpin for PumpedDelivery<E, Bk, C, K>
where <Bk as IoBackend>::Notification: UnsafeUnpin, Arc<Mutex<Option<Engine<E, Bk, C, K>>>>: UnsafeUnpin,

§

impl<E, Bk, C, K> UnwindSafe for PumpedDelivery<E, Bk, C, K>
where <Bk as IoBackend>::Notification: UnwindSafe, Arc<Mutex<Option<Engine<E, Bk, C, K>>>>: UnwindSafe,

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.