Struct barrage::SharedReceiver
source · [−]Expand description
A shared receiver is similar to a receiver, but it shares a mailbox with the other shared receivers from which it originates (was cloned from). Thus, only one shared receiver with the same mailbox will receive a broadcast.
Implementations
sourceimpl<T: Clone + Unpin> SharedReceiver<T>
impl<T: Clone + Unpin> SharedReceiver<T>
sourcepub fn upgrade(self) -> Receiver<T>
pub fn upgrade(self) -> Receiver<T>
Upgrades this shared receiver into a full receiver with its own mailbox
sourcepub fn same_mailbox(&self, other: &SharedReceiver<T>) -> bool
pub fn same_mailbox(&self, other: &SharedReceiver<T>) -> bool
Checks whether this shared receiver shares a mailbox with another.
sourcepub fn recv(&self) -> Result<T, Disconnected>
pub fn recv(&self) -> Result<T, Disconnected>
Receive a broadcast message. If there are none in the queue, it will block until another is sent or all senders disconnect.
sourcepub fn try_recv(&self) -> Result<Option<T>, Disconnected>
pub fn try_recv(&self) -> Result<Option<T>, Disconnected>
Try to receive a broadcast message. If there are none in the queue, it will return None
, or
if there are no senders it will return Disconnected
.
sourcepub fn recv_async(&self) -> RecvFut<'_, T>ⓘNotable traits for RecvFut<'a, T>impl<'a, T: Clone + Unpin> Future for RecvFut<'a, T> type Output = Result<T, Disconnected>;
pub fn recv_async(&self) -> RecvFut<'_, T>ⓘNotable traits for RecvFut<'a, T>impl<'a, T: Clone + Unpin> Future for RecvFut<'a, T> type Output = Result<T, Disconnected>;
Receive a broadcast message. If there are none in the queue, it will asynchronously wait until another is sent or all senders disconnect.
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for SharedReceiver<T>
impl<T> Send for SharedReceiver<T> where
T: Send + Sync,
impl<T> Sync for SharedReceiver<T> where
T: Send + Sync,
impl<T> Unpin for SharedReceiver<T>
impl<T> UnwindSafe for SharedReceiver<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more