Skip to main content

SometimesUnbounded

Type Alias SometimesUnbounded 

Source
type SometimesUnbounded = SometimesUnboundedSink<(AnyChanCell, Option<QueuedCellPaddingInfo>), ChannelSender>;
Expand description

The type of our SometimesUnboundedSink, as instantiated.

We use this to queue control cells.

Aliased Type§

struct SometimesUnbounded {
    buf: VecDeque<(ChanCell<AnyChanMsg>, Option<QueuedCellPaddingInfo>)>,
    inner: ChannelSender,
}

Fields§

§buf: VecDeque<(ChanCell<AnyChanMsg>, Option<QueuedCellPaddingInfo>)>

Things we couldn’t send_unbounded right away

Invariants:

  • Everything here must be fed to inner before any further user data (unbounded user data may be appended).

  • If this is nonempty, the executor knows to wake this task. This is achieved as follows: If this is nonempty, inner.poll_ready() has been called.

§inner: ChannelSender

The actual sink

This also has the relevant Waker.

§Waker invariant

Whenever either

  • The last call to any of our public methods returned Pending, or
  • buf is nonempty,

the last method call inner also returned Pending. (Or, we have reported an error.)

So, in those situations, this task has been recorded for wakeup by inner (specifically, its other end, if it’s a channel) when inner becomes readable.

Therefore this task will be woken up, and, if the caller actually polls us again (as is usual and is required by our docs), we’ll drain any queued data.