pub struct PumpedDelivery<E, Bk, C, K>{ /* 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,
impl<E, Bk, C, K> PumpedDelivery<E, Bk, C, K>where
E: EpochId + 'static,
Bk: IoBackend,
<Bk as IoBackend>::Notification: Waitable,
K: StampClock,
Sourcepub fn new(
engine: Engine<E, Bk, C, K>,
) -> Result<PumpedDelivery<E, Bk, C, K>, (Error, Box<Engine<E, Bk, C, K>>)>
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.
Sourcepub fn with_notification(
engine: Engine<E, Bk, C, K>,
notification: <Bk as IoBackend>::Notification,
) -> PumpedDelivery<E, Bk, C, K>
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.
Sourcepub fn pump(&mut self, timeout: Option<Duration>) -> Pumped
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>
impl<E, Bk, C, K> PumpedDelivery<E, Bk, C, K>
Sourcepub fn engine(&self) -> EngineGuard<'_, Engine<E, Bk, C, K>>
pub fn engine(&self) -> EngineGuard<'_, Engine<E, Bk, C, K>>
The engine, locked: what a consumer call acts through.
The engine’s slot, for a path of the driver’s own that reaches it on another thread.
Sourcepub fn into_engine(self) -> Engine<E, Bk, C, K>
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.