pub struct Sender<T> { /* private fields */ }
Expand description
One of the Sender, created by calling queue
Implementations
sourceimpl<T> Sender<T>
impl<T> Sender<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) = jiffy::queue::<usize>();
// The receiver gets dropped and is therefore now considered closed
drop(rx);
assert_eq!(true, tx.is_closed());
sourcepub fn enqueue(&self, data: T) -> Result<(), (T, EnqueueError)>
pub fn enqueue(&self, data: T) -> Result<(), (T, EnqueueError)>
Enqueues the given Data on the queue
Returns
If the Data was sucessfully enqueued Ok
will be returned, otherwise
it will return the right Error according to the EnqueueError
.
However as this is an unbounded-Queue, the only real reason for a
failure is when the receiving Side was dropped/closed.
Example
let (rx, tx) = jiffy::queue::<usize>();
// Enqueue some Data
tx.enqueue(13);
tx.enqueue(14);
tx.enqueue(15);
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Sender<T>
impl<T> Send for Sender<T>
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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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