Skip to main content

RequestKind

Enum RequestKind 

Source
pub enum RequestKind {
    TrackStatus,
    Subscribe,
    Publish,
    Fetch,
    PublishNamespace,
    SubscribeNamespace,
}
Expand description

Which of the six message types draft-17 Section 3.3 lets a bidirectional stream begin with opened a request stream.

Draft-17 Section 3.3: “A request stream begins with one of these six message types: TRACK_STATUS, SUBSCRIBE, PUBLISH, FETCH, PUBLISH_NAMESPACE, and SUBSCRIBE_NAMESPACE. Bidirectional streams MUST NOT begin with any other message type unless negotiated.”

The set is per draft and is not stable across drafts: draft-18 added SUBSCRIBE_TRACKS and renumbered SUBSCRIBE_NAMESPACE from 0x11 to 0x50. A six-variant enum here is what makes it impossible to name draft-18’s seventh kind in draft-17 code.

Variants§

§

TrackStatus

TRACK_STATUS, 0x0D.

§

Subscribe

SUBSCRIBE, 0x03.

§

Publish

PUBLISH, 0x1D.

§

Fetch

FETCH, 0x16 — standalone or joining.

§

PublishNamespace

PUBLISH_NAMESPACE, 0x06.

§

SubscribeNamespace

SUBSCRIBE_NAMESPACE, 0x11 on this draft.

Implementations§

Source§

impl RequestKind

Source

pub const fn message_type(self) -> MessageType

The message type a request stream of this kind begins with.

Source

pub const fn from_message_type(ty: MessageType) -> Option<RequestKind>

The kind of request stream ty opens, or None when it opens none.

The inverse of message_type and the classifier the accept path runs on the first message of a bidirectional stream the peer opened. None is the PROTOCOL_VIOLATION case of draft-17 Section 3.3.

Like starts_a_request_stream the match is exhaustive over MessageType with no wildcard arm, so a message type added in a later draft stops this compiling until someone classifies it; the unit test below holds the two functions to the same answer for every assigned type, so neither can drift from the other.

Trait Implementations§

Source§

impl Clone for RequestKind

Source§

fn clone(&self) -> RequestKind

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 Copy for RequestKind

Source§

impl Debug for RequestKind

Source§

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

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

impl Eq for RequestKind

Source§

impl PartialEq for RequestKind

Source§

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

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