Struct futures_intrusive::channel::shared::GenericStateReceiver
source · pub struct GenericStateReceiver<MutexType, T>where
MutexType: RawMutex,
T: Clone + 'static,{ /* private fields */ }
Expand description
The receiving side of a channel which can be used to exchange values between concurrent tasks.
Tasks can receive values from the channel through the receive
method.
The returned Future will get resolved when a value is sent into the channel.
Implementations
sourceimpl<MutexType, T> GenericStateReceiver<MutexType, T>where
MutexType: RawMutex + 'static,
T: Clone,
impl<MutexType, T> GenericStateReceiver<MutexType, T>where
MutexType: RawMutex + 'static,
T: Clone,
sourcepub fn receive(&self, state_id: StateId) -> StateReceiveFuture<MutexType, T>ⓘNotable traits for StateReceiveFuture<MutexType, T>impl<MutexType, T> Future for StateReceiveFuture<MutexType, T> type Output = Option<(StateId, T)>;
pub fn receive(&self, state_id: StateId) -> StateReceiveFuture<MutexType, T>ⓘNotable traits for StateReceiveFuture<MutexType, T>impl<MutexType, T> Future for StateReceiveFuture<MutexType, T> type Output = Option<(StateId, T)>;
Returns a future that gets fulfilled when a value is written to the channel
or the channel is closed.
state_id
specifies the minimum state ID that should be retrieved
by the receive
operation.
The returned StateReceiveFuture
will get fulfilled with the
retrieved value as well as the StateId
which is required to retrieve
the following state
sourcepub fn try_receive(&self, state_id: StateId) -> Option<(StateId, T)>
pub fn try_receive(&self, state_id: StateId) -> Option<(StateId, T)>
Attempt to retrieve a value whose StateId
is greater than the one provided.
Returns None
if no value is found in the channel, or if the current StateId
of the value is less or equal to the one provided.