Inner

Struct Inner 

Source
pub(crate) struct Inner<T> {
    pub(crate) queue: VecDeque<(T, usize)>,
    pub(crate) capacity: usize,
    pub(crate) receiver_count: usize,
    pub(crate) inactive_receiver_count: usize,
    pub(crate) sender_count: usize,
    pub(crate) head_pos: u64,
    pub(crate) overflow: bool,
    pub(crate) await_active: bool,
    pub(crate) is_closed: bool,
    pub(crate) send_ops: Event,
    pub(crate) recv_ops: Event,
}

Fields§

§queue: VecDeque<(T, usize)>§capacity: usize§receiver_count: usize§inactive_receiver_count: usize§sender_count: usize§head_pos: u64

Send sequence number of the front of the queue

§overflow: bool§await_active: bool§is_closed: bool§send_ops: Event

Send operations waiting while the channel is full.

§recv_ops: Event

Receive operations waiting while the channel is empty and not closed.

Implementations§

Source§

impl<T> Inner<T>

Source

pub(crate) fn try_recv_at( &mut self, pos: &mut u64, ) -> Result<Result<T, &T>, TryRecvError>

Try receiving at the given position, returning either the element or a reference to it.

Result is used here instead of Cow because we don’t have a Clone bound on T.

Source

pub(crate) fn close(&mut self) -> bool

Closes the channel and notifies all waiting operations.

Returns true if this call has closed the channel and it was not closed already.

Source

pub(crate) fn set_capacity(&mut self, new_cap: usize)

Set the channel capacity.

There are times when you need to change the channel’s capacity after creating it. If the new_cap is less than the number of messages in the channel, the oldest messages will be dropped to shrink the channel.

Source

pub(crate) fn close_channel(&mut self)

Close the channel if there aren’t any receivers present anymore

Trait Implementations§

Source§

impl<T: Debug> Debug for Inner<T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> !Freeze for Inner<T>

§

impl<T> RefUnwindSafe for Inner<T>
where T: RefUnwindSafe,

§

impl<T> Send for Inner<T>
where T: Send,

§

impl<T> Sync for Inner<T>
where T: Sync,

§

impl<T> Unpin for Inner<T>
where T: Unpin,

§

impl<T> UnwindSafe for Inner<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.