Skip to main content

Plan

Enum Plan 

Source
pub(crate) enum Plan {
    WriteNow(Bytes),
    Nothing,
    Terminal,
    RejectStream {
        code: u64,
    },
    OpenStreamAfter {
        after: Duration,
    },
    SerializeStreamAfter {
        target: StreamKey,
    },
    CloseSession {
        code: u32,
        reason: Bytes,
    },
}
Expand description

The wire operation execute has decided on but not performed.

This module owns what the bytes are; session.rs owns the transport handle and the await. Keeping the split here is what lets every rule below be unit-tested with no QUIC, no runtime and no session — the same argument egress.rs makes for its egress::EgressSink.

Variants§

§

WriteNow(Bytes)

Hand these bytes to the transport now: send.write_all on a stream site, send_datagram at the datagram site.

A failure at the datagram site is a Reporter::failed, not a session teardown: one undeliverable datagram must not take the session with it.

§

Nothing

Nothing goes to the wire on this call. The unit was queued behind something already waiting, elided, or the site carries no bytes.

§

Terminal

A positional terminal is now at the tail of the queue. Drain honouring release times; the drain returns DrainOutcome::Terminated { forwarded, code } and the stream is over — do not finish() it.

§

RejectStream

Do not forward this stream. Stop the source with code; at StreamSite::Header also reset the destination, which already exists and has carried nothing.

Fields

§code: u64

The application error code.

§

OpenStreamAfter

Forward this stream, but do not call dest.open_uni() until after has elapsed. Only StreamSite::Open can produce this — by the header site the peer stream exists, and that site refuses StreamAction::OpenAfter with Refusal::WrongSite rather than accepting a deferral it cannot perform.

session.rs’s unidirectional accept loop consumes it, and the deferral reaches the wire: the stream is spawned with no destination handle, and the per-stream task sleeps after — racing the session’s cancellation — before it opens one. Nothing is read from the source in the meantime, so the peer sees no stream at all for after and then a whole one.

The open happens inside the task but still before the first source byte is read, which is what keeps the two reject sites different on this topology too: by the time the header decision is taken the peer stream exists, so a rejection there still resets it.

Fields

§after: Duration

How long to wait before opening the peer stream.

§

SerializeStreamAfter

Forward this stream, but write nothing on it until target has ended. An unknown or already-ended target proceeds immediately and reports SerializeTargetUnknown once.

Consumed at both stream sites, because it defers the first write rather than the stream’s existence: from the open site it is carried into the pipe, which waits before reading; at the header site the wait happens in the FramerOut::Header arm, ahead of the header’s own bytes. Either way the peer stream is already open and silent.

One stream never waits: the unidirectional control stream of a draft whose control plane is a pair of them. Holding its first write would hold SETUP, and the session with it.

Fields

§target: StreamKey

The stream this one waits on.

§

CloseSession

A session close was recorded in the SessionCloser, and the session token is already cancelledSessionCloser::request cancels as it records, so the caller does not have to. Return from the forwarding task; run_with_transport reads the code and reason back out of the closer at session.rs:255-256.

The unit itself is not forwarded: the hook returned a close instead of an action on it.

Fields

§code: u32

The session termination code.

§reason: Bytes

The reason phrase.

Trait Implementations§

Source§

impl Clone for Plan

Source§

fn clone(&self) -> Plan

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 Plan

Source§

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

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

impl Eq for Plan

Source§

impl PartialEq for Plan

Source§

fn eq(&self, other: &Plan) -> 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 Plan

Auto Trait Implementations§

§

impl !Freeze for Plan

§

impl RefUnwindSafe for Plan

§

impl Send for Plan

§

impl Sync for Plan

§

impl Unpin for Plan

§

impl UnsafeUnpin for Plan

§

impl UnwindSafe for Plan

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