Skip to main content

ShapeOutcome

Enum ShapeOutcome 

Source
#[non_exhaustive]
pub enum ShapeOutcome { Dropped, Expired, Policed, StreamReset { code: u64, }, }
Expand description

What ProxyEvent::Shaped reports the shaper did.

#[non_exhaustive]; derives PartialEq/Eq like Effect and ImpairmentKind, so a test destructures the event and compares this.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Dropped

A unit was discarded by Overflow::DropTail.

The unit went through the framer’s elide path, so absolute object IDs on drafts 14-19 stay correct; a unit an elide guard refused was admitted instead of dropped and is reported as a refusal, not here.

§

Expired

A queued unit outlived max_hold under Expiry::ResetStream.

Decided at release time rather than at admission: the queue notices the overrun when it next looks at its head, replaces everything it was holding with the reset the policy asked for, and reports this. So the event says the whole destination stream was abandoned, not that one unit was — which is why it carries an empty class for the same reason Self::StreamReset does.

Emitted once per stream. The queue is gone after the first one, so there is nothing left to expire.

This variant read “no producer yet” for as long as expiry was decided nowhere; it now has one, and asserting on it is actions_shaping.rs’s business rather than a promise waiting to be kept.

§

Policed

A datagram was discarded because its class’s bucket had no tokens for it.

Policing rather than shaping, and the difference is that there is no queue: a datagram arriving over its class’s configured rate is dropped at admission rather than held until the tokens arrive. That is the only sound answer for this carrier — a queue would impose an order the protocol does not have, and a datagram has no successor whose framing depends on it, which is what makes discarding one harmless where discarding a queued stream unit is not.

Carried only by ProxyEvent::ShapedDatagram. Self::Dropped is the stream carrier’s answer and says something different: that an overflow policy discarded a unit the queue had no room for.

§

StreamReset

The destination stream was abandoned by an overflow or expiry policy.

Fields

§code: u64

The application error code it was reset with.

Trait Implementations§

Source§

impl Clone for ShapeOutcome

Source§

fn clone(&self) -> ShapeOutcome

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 ShapeOutcome

Source§

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

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

impl Eq for ShapeOutcome

Source§

impl PartialEq for ShapeOutcome

Source§

fn eq(&self, other: &ShapeOutcome) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ShapeOutcome

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.

Source§

impl<T> Instrument for T

Source§

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

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

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

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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