Struct kaspa_utils::channel::Channel
source · 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> 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§
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