pub struct NonBlockingSender<T> { /* private fields */ }
Expand description
A SPSC sender guaranteed to never block when sending a message. This is a strong constraint, enforced by WebAssembly on the main thread, so this should only be preferred over other mpsc channels where non-blocking behaviour is required.
Cannot be cloned, so if you want multiple clients to send messages then you need a sender that may block
for very short periods when sending a message - see NonBlockingSender::mpsc
.
Implementations§
Source§impl<T> NonBlockingSender<T>
impl<T> NonBlockingSender<T>
Sourcepub fn try_send(&mut self, message: T) -> SendResult<T>
pub fn try_send(&mut self, message: T) -> SendResult<T>
Tries to send a message to the receiving channel without ever blocking, even briefly.
§Result
This method fails if the receiving queue is full, or if the receiver has been dropped.
Sourcepub fn mpsc(self) -> MicroBlockingSender<T>
pub fn mpsc(self) -> MicroBlockingSender<T>
Makes this channel into a mpsc
channel, but where the sender is allowed to block for very small durations.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for NonBlockingSender<T>
impl<T> RefUnwindSafe for NonBlockingSender<T>where
T: RefUnwindSafe,
impl<T> Send for NonBlockingSender<T>where
T: Send,
impl<T> Sync for NonBlockingSender<T>
impl<T> Unpin for NonBlockingSender<T>where
T: Unpin,
impl<T> UnwindSafe for NonBlockingSender<T>where
T: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more