Struct crossbeam_channel::flavors::zero::Channel
source · pub(crate) struct Channel<T> {
inner: Mutex<Inner>,
_marker: PhantomData<T>,
}
Expand description
Zero-capacity channel.
Fields§
§inner: Mutex<Inner>
Inner representation of the channel.
_marker: PhantomData<T>
Indicates that dropping a Channel<T>
may drop values of type T
.
Implementations§
source§impl<T> Channel<T>
impl<T> Channel<T>
sourcefn start_send(&self, token: &mut Token) -> bool
fn start_send(&self, token: &mut Token) -> bool
Attempts to reserve a slot for sending a message.
sourcepub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T>
pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T>
Writes a message into the packet.
sourcefn start_recv(&self, token: &mut Token) -> bool
fn start_recv(&self, token: &mut Token) -> bool
Attempts to pair up with a sender.
sourcepub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()>
pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()>
Reads a message from the packet.
sourcepub(crate) fn try_send(&self, msg: T) -> Result<(), TrySendError<T>>
pub(crate) fn try_send(&self, msg: T) -> Result<(), TrySendError<T>>
Attempts to send a message into the channel.
sourcepub(crate) fn send(
&self,
msg: T,
deadline: Option<Instant>,
) -> Result<(), SendTimeoutError<T>>
pub(crate) fn send( &self, msg: T, deadline: Option<Instant>, ) -> Result<(), SendTimeoutError<T>>
Sends a message into the channel.
sourcepub(crate) fn try_recv(&self) -> Result<T, TryRecvError>
pub(crate) fn try_recv(&self) -> Result<T, TryRecvError>
Attempts to receive a message without blocking.
sourcepub(crate) fn recv(
&self,
deadline: Option<Instant>,
) -> Result<T, RecvTimeoutError>
pub(crate) fn recv( &self, deadline: Option<Instant>, ) -> Result<T, RecvTimeoutError>
Receives a message from the channel.
sourcepub(crate) fn disconnect(&self) -> bool
pub(crate) fn disconnect(&self) -> bool
Disconnects the channel and wakes up all blocked senders and receivers.
Returns true
if this call disconnected the channel.
Auto Trait Implementations§
impl<T> !Freeze for Channel<T>
impl<T> RefUnwindSafe for Channel<T>where
T: RefUnwindSafe,
impl<T> !Send for Channel<T>
impl<T> !Sync for Channel<T>
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