pub struct Channel<T> { /* private fields */ }Expand description
Multiple producers multiple consumers channel
Implementations§
Source§impl<T> Channel<T>
impl<T> Channel<T>
pub fn new(channel: (Sender<T>, Receiver<T>)) -> Channel<T>
pub fn bounded(capacity: usize) -> Channel<T>
pub fn sender(&self) -> Sender<T>
pub fn receiver(&self) -> Receiver<T>
pub fn close(&self)
pub fn is_closed(&self) -> bool
pub async fn recv(&self) -> Result<T, RecvError>
pub fn try_recv(&self) -> Result<T, TryRecvError>
pub async fn send(&self, msg: T) -> Result<(), SendError<T>>
pub fn try_send(&self, msg: T) -> Result<(), TrySendError<T>>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn receiver_count(&self) -> usize
pub fn sender_count(&self) -> usize
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>
impl<T> UnwindSafe for Channel<T>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more