pub struct Sender<T>(_);
Expand description
The sending Half for a NCQ based MPMC-Queue
Implementations
sourceimpl<T> Sender<T>
impl<T> Sender<T>
sourcepub fn try_enqueue(&self, data: T) -> Result<(), (EnqueueError, T)>
pub fn try_enqueue(&self, data: T) -> Result<(), (EnqueueError, T)>
Attempts to enqueue the Data on the Queue
Example
Valid/Normal enqueue
let (rx, tx) = ncq::queue::<u64>(10);
assert_eq!(Ok(()), tx.try_enqueue(13));
Queue is already full
let (rx, tx) = ncq::queue::<u64>(1);
// Enqueue an Element to fill the Queue
tx.try_enqueue(13);
assert_eq!(Err((EnqueueError::Full, 13)), tx.try_enqueue(13));
sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Checks if the Receiving Half has closed the Queue, meaning that no more Elements would be dequeued from the Queue and therefore also should not be inserted anymore.
Example
let (rx, tx) = ncq::queue::<u64>(10);
assert_eq!(false, tx.is_closed());
drop(rx);
assert_eq!(true, tx.is_closed());
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for Sender<T>
impl<T> Send for Sender<T> where
T: Send,
impl<T> Sync for Sender<T>
impl<T> Unpin for Sender<T>
impl<T> !UnwindSafe for Sender<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