pub enum RequestKind {
TrackStatus,
Subscribe,
Publish,
Fetch,
PublishNamespace,
SubscribeNamespace,
SubscribeTracks,
}Expand description
Which of the seven message types draft-19 Section 3.3 lets a bidirectional stream begin with opened a request stream.
Draft-19 Section 3.3: “A request stream begins with one of these seven message types: TRACK_STATUS, SUBSCRIBE, PUBLISH, FETCH, PUBLISH_NAMESPACE, SUBSCRIBE_NAMESPACE, and SUBSCRIBE_TRACKS. Bidirectional streams MUST NOT begin with any other message type unless negotiated.”
The set is per draft and is not stable across drafts: draft-17 had six of these, and draft-18 — whose set draft-19 keeps — both added SUBSCRIBE_TRACKS and renumbered SUBSCRIBE_NAMESPACE from 0x11 to 0x50. A seven-variant enum here is what makes it impossible to label a draft-19 request stream with a kind this draft does not have.
Variants§
TrackStatus
TRACK_STATUS, 0x0D.
Subscribe
SUBSCRIBE, 0x03.
Publish
PUBLISH, 0x1D.
Fetch
FETCH, 0x16 — standalone or joining.
PublishNamespace
PUBLISH_NAMESPACE, 0x06.
SubscribeNamespace
SUBSCRIBE_NAMESPACE, 0x50 on this draft — 0x11 on draft-17.
SubscribeTracks
SUBSCRIBE_TRACKS, 0x51. Added in draft-18; draft-17 has no such message and no such request stream.
Implementations§
Source§impl RequestKind
impl RequestKind
Sourcepub const fn message_type(self) -> MessageType
pub const fn message_type(self) -> MessageType
The message type a request stream of this kind begins with.
Sourcepub const fn from_message_type(ty: MessageType) -> Option<RequestKind>
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-19
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
impl Clone for RequestKind
Source§fn clone(&self) -> RequestKind
fn clone(&self) -> RequestKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more