pub struct SignalReceiver<T> { /* private fields */ }
Expand description
The SignalReceiver
is used to asynchronously receive messages from the
shared message queue. Only one receiver can be active at a time; new
receivers are created by cloning the original. When a receiver is cloned,
it becomes the active receiver, and the previous receiver will no longer
receive messages.
Implementations§
Source§impl<T> SignalReceiver<T>
impl<T> SignalReceiver<T>
Sourcepub fn recv(&self) -> impl Future<Output = Option<T>>
pub fn recv(&self) -> impl Future<Output = Option<T>>
Asynchronously receives the next message from the queue. Only the active
receiver is allowed to receive messages. If there are no messages in the
queue, the receiver will wait until a new message is sent.
If this receiver is not active, the future will return None
.
Trait Implementations§
Source§impl<T> Clone for SignalReceiver<T>
impl<T> Clone for SignalReceiver<T>
Source§fn clone(&self) -> Self
fn clone(&self) -> Self
Clones the receiver and makes the new receiver the active one. The original receiver will no longer receive messages after this clone. This ensures only the most recent receiver can access the message queue.
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more