Skip to main content

AnyArrival

Enum AnyArrival 

Source
pub enum AnyArrival {
    Subscribe {
        message: AnyControlMessage,
        request: AnyInboundRequest,
    },
    Other(AnyControlMessage),
}
Expand description

What arrived from the peer, and whether this facade has a handle for it.

AnyConnection::recv_inbound returns one of these per message. Everything is returned rather than filtered, because on drafts 07 through 16 the same stream carries the peer’s requests and the answers to this side’s own — a reader that quietly dropped what it was not looking for would swallow a SUBSCRIBE_OK somebody was waiting on.

The variants differ in size for the reason AnyRequest’s do — one of them carries a request stream and the other does not — and boxing to close the gap would put an allocation on every message of every draft to flatter a build no released configuration uses.

Variants§

§

Subscribe

The peer subscribed to a track this session publishes.

Answer it with AnyConnection::accept_subscribe. The message is the SUBSCRIBE as it arrived, which is where the track it names lives — and, on drafts 07 through 11, the Track Alias the subscriber chose.

Fields

§message: AnyControlMessage

The SUBSCRIBE, decoded by the negotiated draft.

§request: AnyInboundRequest

The handle to answer it through.

§

Other(AnyControlMessage)

Anything else the peer sent.

On drafts 07 through 16 that is any control message which is not a SUBSCRIBE: a response to one of this side’s own requests, or something sent unprompted such as MAX_REQUEST_ID. It has already been dispatched into the endpoint by the time it arrives here, so the session’s state is correct whether the caller reads it or not.

From draft-17 it is a request of a kind this facade has no entry point for, and its stream has already been reset — there is no handle in this variant to hold it open with, and a stream nobody holds is one the peer is owed an answer on forever. That asymmetry is real: on the older drafts this variant is passive, and on the newer ones producing it refuses something.

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> 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, 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