pub(crate) struct Shared<T: 'static> {
pub(super) len: AtomicUsize,
_p: PhantomData<T>,
}
Fields§
§len: AtomicUsize
Number of pending tasks in the queue. This helps prevent unnecessary locking in the hot path.
_p: PhantomData<T>
Implementations§
pub(crate) fn new() -> (Shared<T>, Synced)
pub(crate) fn is_empty(&self) -> bool
pub(crate) fn is_closed(&self, synced: &Synced) -> bool
sourcepub(crate) fn close(&self, synced: &mut Synced) -> bool
pub(crate) fn close(&self, synced: &mut Synced) -> bool
Closes the injection queue, returns true
if the queue is open when the
transition is made.
pub(crate) fn len(&self) -> usize
sourcepub(crate) unsafe fn push(&self, synced: &mut Synced, task: Notified<T>)
pub(crate) unsafe fn push(&self, synced: &mut Synced, task: Notified<T>)
Pushes a value into the queue.
This does nothing if the queue is closed.
§Safety
Must be called with the same Synced
instance returned by Inject::new
sourcepub(crate) unsafe fn push_batch<L, I>(&self, shared: L, iter: I)
pub(crate) unsafe fn push_batch<L, I>(&self, shared: L, iter: I)
Pushes several values into the queue.
§Safety
Must be called with the same Synced
instance returned by Inject::new
Trait Implementations§
Auto Trait Implementations§
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