Struct tokio::sync::mpsc::chan::Chan

source ·
pub(super) struct Chan<T, S> {
    tx: CachePadded<Tx<T>>,
    rx_waker: CachePadded<AtomicWaker>,
    notify_rx_closed: Notify,
    semaphore: S,
    tx_count: AtomicUsize,
    tx_weak_count: AtomicUsize,
    rx_fields: UnsafeCell<RxFields<T>>,
}

Fields§

§tx: CachePadded<Tx<T>>

Handle to the push half of the lock-free list.

§rx_waker: CachePadded<AtomicWaker>

Receiver waker. Notified when a value is pushed into the channel.

§notify_rx_closed: Notify

Notifies all tasks listening for the receiver being dropped.

§semaphore: S

Coordinates access to channel’s capacity.

§tx_count: AtomicUsize

Tracks the number of outstanding sender handles.

When this drops to zero, the send half of the channel is closed.

§tx_weak_count: AtomicUsize

Tracks the number of outstanding weak sender handles.

§rx_fields: UnsafeCell<RxFields<T>>

Only accessed by Rx handle.

Implementations§

source§

impl<T, S> Chan<T, S>

source

fn send(&self, value: T)

source

pub(super) fn decrement_weak_count(&self)

source

pub(super) fn increment_weak_count(&self)

source

pub(super) fn strong_count(&self) -> usize

source

pub(super) fn weak_count(&self) -> usize

Trait Implementations§

source§

impl<T, S> Debug for Chan<T, S>where S: Debug,

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T, S> Drop for Chan<T, S>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<T: Send, S: Send> Send for Chan<T, S>

source§

impl<T: Send, S: Sync> Sync for Chan<T, S>

Auto Trait Implementations§

§

impl<T, S> !RefUnwindSafe for Chan<T, S>

§

impl<T, S> Unpin for Chan<T, S>where S: Unpin,

§

impl<T, S> !UnwindSafe for Chan<T, S>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.