pub struct UnboundedSender<T> { /* private fields */ }
Expand description
The Sender-Half of an unbounded Queue
Implementations
sourceimpl<T> UnboundedSender<T>
impl<T> UnboundedSender<T>
sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Checks if the Queue has been closed by the Consumer
Example
let (rx, tx) = unbounded::queue::<usize>();
// Drop the Consumer and therefore also close the Queue
drop(rx);
assert_eq!(true, tx.is_closed());
sourcepub fn enqueue(&mut self, data: T) -> Result<(), (T, EnqueueError)>
pub fn enqueue(&mut self, data: T) -> Result<(), (T, EnqueueError)>
Enqueues the Data
Example
Normal Enqueue, where the Queue is not closed
let (rx, mut tx) = unbounded::queue::<usize>();
assert_eq!(Ok(()), tx.enqueue(13));
Failed Enqueue, the Queue has been closed
let (rx, mut tx) = unbounded::queue::<usize>();
// Drop the Consumer and therefore also close the Queue
drop(rx);
assert_eq!(Err((13, EnqueueError::Closed)), tx.enqueue(13));
Trait Implementations
sourceimpl<T> Debug for UnboundedSender<T>
impl<T> Debug for UnboundedSender<T>
sourceimpl<T> Drop for UnboundedSender<T>
impl<T> Drop for UnboundedSender<T>
impl<T> Send for UnboundedSender<T>
impl<T> Sync for UnboundedSender<T>
Auto Trait Implementations
impl<T> !RefUnwindSafe for UnboundedSender<T>
impl<T> Unpin for UnboundedSender<T>
impl<T> !UnwindSafe for UnboundedSender<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