Struct Channel
pub struct Channel<T> { /* private fields */ }
Available on crate feature
threading
only.Expand description
Blocking channel for sending data between threads.
Implementations§
§impl<T> Channel<T>
impl<T> Channel<T>
pub const fn new() -> Channel<T>
pub fn send(&self, something: &T)
pub fn send(&self, something: &T)
Send on the channel (blocking).
If there is no receiver waiting yet, the current thread is suspended until a receiver is ready.
§Panics
Panics if this is called outside of a thread context.
pub fn try_send(&self, something: &T) -> bool
pub fn try_send(&self, something: &T) -> bool
Try to send on the channel (non-blocking).
Returns true
if a receiver was waiting and received
the data, false
otherwise.
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> Unpin for Channel<T>where
T: Unpin,
impl<T> UnwindSafe for Channel<T>where
T: UnwindSafe,
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