pub struct Channel<T> { /* private fields */ }
Expand description
An asynchronous multi-producer multi-consumer channel based on tokio::sync::Notify.
Implementations§
Source§impl<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)
pub fn flush_pending_prefetch_requests<F>(&self, f: F)
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> !Freeze for Channel<T>
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§
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