pub(crate) struct Channel<T> {
inner: Mutex<Inner>,
_marker: PhantomData<T>,
}
🔬This is a nightly-only experimental API. (
mpmc_channel
#126840)Expand description
Zero-capacity channel.
Fields§
§inner: Mutex<Inner>
🔬This is a nightly-only experimental API. (
mpmc_channel
#126840)Inner representation of the channel.
_marker: PhantomData<T>
🔬This is a nightly-only experimental API. (
mpmc_channel
#126840)Indicates that dropping a Channel<T>
may drop values of type T
.
Implementations§
Source§impl<T> Channel<T>
impl<T> Channel<T>
Sourcepub(crate) fn new() -> Self
🔬This is a nightly-only experimental API. (mpmc_channel
#126840)
pub(crate) fn new() -> Self
mpmc_channel
#126840)Constructs a new zero-capacity channel.
Sourcepub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T>
🔬This is a nightly-only experimental API. (mpmc_channel
#126840)
pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T>
mpmc_channel
#126840)Writes a message into the packet.
Sourcepub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()>
🔬This is a nightly-only experimental API. (mpmc_channel
#126840)
pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()>
mpmc_channel
#126840)Reads a message from the packet.
Sourcepub(crate) fn try_send(&self, msg: T) -> Result<(), TrySendError<T>>
🔬This is a nightly-only experimental API. (mpmc_channel
#126840)
pub(crate) fn try_send(&self, msg: T) -> Result<(), TrySendError<T>>
mpmc_channel
#126840)Attempts to send a message into the channel.
Sourcepub(crate) fn send(
&self,
msg: T,
deadline: Option<Instant>,
) -> Result<(), SendTimeoutError<T>>
🔬This is a nightly-only experimental API. (mpmc_channel
#126840)
pub(crate) fn send( &self, msg: T, deadline: Option<Instant>, ) -> Result<(), SendTimeoutError<T>>
mpmc_channel
#126840)Sends a message into the channel.
Sourcepub(crate) fn try_recv(&self) -> Result<T, TryRecvError>
🔬This is a nightly-only experimental API. (mpmc_channel
#126840)
pub(crate) fn try_recv(&self) -> Result<T, TryRecvError>
mpmc_channel
#126840)Attempts to receive a message without blocking.
Sourcepub(crate) fn recv(
&self,
deadline: Option<Instant>,
) -> Result<T, RecvTimeoutError>
🔬This is a nightly-only experimental API. (mpmc_channel
#126840)
pub(crate) fn recv( &self, deadline: Option<Instant>, ) -> Result<T, RecvTimeoutError>
mpmc_channel
#126840)Receives a message from the channel.
Sourcepub(crate) fn disconnect(&self) -> bool
🔬This is a nightly-only experimental API. (mpmc_channel
#126840)
pub(crate) fn disconnect(&self) -> bool
mpmc_channel
#126840)Disconnects the channel and wakes up all blocked senders and receivers.
Returns true
if this call disconnected the channel.
Sourcepub(crate) fn len(&self) -> usize
🔬This is a nightly-only experimental API. (mpmc_channel
#126840)
pub(crate) fn len(&self) -> usize
mpmc_channel
#126840)Returns the current number of messages inside the channel.
Sourcepub(crate) fn capacity(&self) -> Option<usize>
🔬This is a nightly-only experimental API. (mpmc_channel
#126840)
pub(crate) fn capacity(&self) -> Option<usize>
mpmc_channel
#126840)Returns the capacity of 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
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)] const IS_ZST: bool = _
#[doc(hidden)] const IS_ZST: bool = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)Source§#[doc(hidden)] const LAYOUT: Layout = _
#[doc(hidden)] const LAYOUT: Layout = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)Source§#[doc(hidden)] const MAX_SLICE_LEN: usize = _
#[doc(hidden)] const MAX_SLICE_LEN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)The largest safe length for a
[Self]
. Read more