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: u64Send sequence number of the front of the queue
overflow: bool§await_active: bool§is_closed: bool§send_ops: EventSend operations waiting while the channel is full.
recv_ops: EventReceive operations waiting while the channel is empty and not closed.
Implementations§
Source§impl<T> Inner<T>
impl<T> Inner<T>
Sourcepub(crate) fn try_recv_at(
&mut self,
pos: &mut u64,
) -> Result<Result<T, &T>, TryRecvError>
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.
Sourcepub(crate) fn close(&mut self) -> bool
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.
Sourcepub(crate) fn set_capacity(&mut self, new_cap: usize)
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.
Sourcepub(crate) fn close_channel(&mut self)
pub(crate) fn close_channel(&mut self)
Close the channel if there aren’t any receivers present anymore