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