Struct nydus_utils::mpmc::Channel
source · [−]pub struct Channel<T> { /* private fields */ }Expand description
An asynchronous multi-producer multi-consumer channel based on tokio::sync::Notify.
Implementations
sourceimpl<T> Channel<T>
impl<T> Channel<T>
sourcepub fn send(&self, msg: T) -> Result<(), T>
pub fn send(&self, msg: T) -> Result<(), T>
Send a message to the channel.
The message object will be returned on error, to ease the lifecycle management.
sourcepub fn flush_pending_prefetch_requests<F>(&self, f: F) where
F: FnMut(&T) -> bool,
pub fn flush_pending_prefetch_requests<F>(&self, f: F) where
F: FnMut(&T) -> bool,
Flush all pending requests specified by the predicator.
sourcepub fn lock_channel(&self) -> MutexGuard<'_, VecDeque<T>>
pub fn lock_channel(&self) -> MutexGuard<'_, VecDeque<T>>
Lock the channel to block all queue operations.
sourcepub fn notify_waiters(&self)
pub fn notify_waiters(&self)
Notify all waiters.
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for Channel<T>
impl<T> Send for Channel<T> where
T: Send,
impl<T> Sync for Channel<T> where
T: Send,
impl<T> Unpin for Channel<T> where
T: Unpin,
impl<T> UnwindSafe for Channel<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