Skip to main content

Pending

Struct Pending 

Source
pub(crate) struct Pending {
    due_at: Instant,
    expected_at: Instant,
    gate: Option<Gate>,
    item: Item,
    shape: Option<ShapeTag>,
}
Expand description

One unit of traffic waiting for its release time.

Fields§

§due_at: Instant

The earliest instant this unit may be written, and the only instant that gates it. Set once, by whoever built the unit, and never rewritten by the queue — see the module doc’s Ordering is the queue’s; readiness is the unit’s.

§expected_at: Instant

When the queue expects to write it, given everything ahead of it: max(due_at, tail.expected_at, now) at push time.

Reporting and lateness only. It gates nothing, and it is deliberately an over-estimate for a unit queued behind a Hold, whose gate may open long before its EgressConfig::max_hold ceiling.

§gate: Option<Gate>

A Hold’s gate. Releasing it makes the unit due before due_at, which for a held unit is the EgressConfig::max_hold ceiling.

§item: Item

What writing it does.

§shape: Option<ShapeTag>

The shaper’s tag, on a shaped stream only. Attached by PendingQueue::push from the class the pipe loop most recently resolved, so exec’s pushes carry it without exec naming a class.

Implementations§

Source§

impl Pending

Source

pub(crate) fn bytes(raw: Bytes, due_at: Instant) -> Self

Bytes to write no earlier than due_at.

Source

pub(crate) fn elided(due_at: Instant) -> Self

An ordering placeholder that writes nothing.

Source

pub(crate) fn terminal(terminal: Terminal) -> Self

A positional terminal, due as soon as the queue ahead of it drains.

Source

pub(crate) fn with_gate(self, gate: Gate) -> Self

Attach a Hold’s gate. due_at stays the max_hold ceiling.

Source

pub(crate) fn due_at(&self) -> Instant

When this unit becomes due on its own account.

Source

pub(crate) fn expected_at(&self) -> Instant

When the queue expected to write it. Never a gate; see the field.

Source

pub(crate) fn item(&self) -> &Item

What it does. Terminals end the stream.

Source

pub(crate) fn is_terminal(&self) -> bool

Whether this unit ends the stream.

Source

pub(crate) fn len(&self) -> usize

Bytes this unit is holding on the queue’s behalf.

Source

fn is_due(&self, now: Instant) -> bool

Whether this unit may be written at now, on its own account.

Readiness only: whether anything is still queued ahead of it is the deque’s business, and PendingQueue::pop_next_due answers that by looking at the front and nowhere else.

A released gate makes it due, regardless of due_at. Without that clause, releasing a Hold early wakes the release branch to find nothing due and the loop spins hot until EgressConfig::max_hold — one of the two ways this loop can spin hot, and the one that is invisible from the call site.

expected_at is deliberately not consulted: it is the queue’s estimate, and for a unit behind a Hold it is that hold’s ceiling. Gating on it is what stranded whole streams behind a released gate.

Trait Implementations§

Source§

impl Clone for Pending

Source§

fn clone(&self) -> Pending

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Pending

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more