Skip to main content

Frame

Enum Frame 

Source
pub enum Frame {
Show 25 variants Connect { flags: u8, min_version: ProtocolVersion, max_version: ProtocolVersion, auth_token: Vec<u8>, }, ConnectAck { flags: u8, selected_version: ProtocolVersion, capabilities: u32, }, ConnectError { flags: u8, reason_code: u16, message: Option<String>, }, Disconnect { flags: u8, }, Subscribe { flags: u8, stream_id: u32, channel: String, accepted_schemas: Vec<SchemaId>, max_in_flight: u32, }, SubscribeAck { flags: u8, stream_id: u32, subscription_id: u64, selected_schema: SchemaId, }, SubscribeError { flags: u8, stream_id: u32, reason_code: u16, message: Option<String>, }, Unsubscribe { flags: u8, stream_id: u32, subscription_id: u64, }, Publish { flags: u8, stream_id: u32, channel: String, envelope: MessageEnvelope, idempotency_key: Option<String>, }, PublishAck { flags: u8, stream_id: u32, message_id: u64, }, PublishError { flags: u8, stream_id: u32, reason_code: u16, message: Option<String>, }, ConversationOpen { flags: u8, stream_id: u32, conversation_id: u64, subject: String, }, ConversationMessage { flags: u8, stream_id: u32, conversation_id: u64, envelope: MessageEnvelope, }, ConversationClose { flags: u8, stream_id: u32, conversation_id: u64, reason_code: Option<u16>, message: Option<String>, }, ConversationError { flags: u8, stream_id: u32, conversation_id: u64, reason_code: u16, message: Option<String>, }, Accept { flags: u8, stream_id: u32, referenced_message_id: MessageId, }, Defer { flags: u8, stream_id: u32, referenced_message_id: MessageId, reason: Option<String>, }, Reject { flags: u8, stream_id: u32, referenced_message_id: MessageId, reason: Option<String>, }, Ping { flags: u8, }, Pong { flags: u8, }, Push { flags: u8, stream_id: u32, correlation_id: u64, payload: Vec<u8>, }, PushReply { flags: u8, stream_id: u32, correlation_id: u64, payload: Vec<u8>, }, WorkerRegister { flags: u8, registration: WorkerRegistration, }, WorkerRegisterAck { flags: u8, outcome: WorkerRegisterOutcome, }, Unknown { type_id: u8, flags: u8, stream_id: u32, payload: Vec<u8>, },
}
Expand description

A typed protocol frame body plus the header metadata required to encode it.

Variants§

§

Connect

Connection request carrying a supported version range and opaque auth token.

Fields

§flags: u8
§min_version: ProtocolVersion
§max_version: ProtocolVersion
§auth_token: Vec<u8>
§

ConnectAck

Connection success carrying the negotiated protocol version and server capabilities.

Fields

§flags: u8
§selected_version: ProtocolVersion
§capabilities: u32
§

ConnectError

Connection failure carrying a numeric reason and optional message.

Fields

§flags: u8
§reason_code: u16
§message: Option<String>
§

Disconnect

Connection close notification with no payload.

Fields

§flags: u8
§

Subscribe

Channel subscription request carrying a channel and accepted schema hashes.

Fields

§flags: u8
§stream_id: u32
§channel: String
§accepted_schemas: Vec<SchemaId>
§max_in_flight: u32
§

SubscribeAck

Channel subscription success carrying a subscription id and selected schema.

Fields

§flags: u8
§stream_id: u32
§subscription_id: u64
§selected_schema: SchemaId
§

SubscribeError

Channel subscription failure carrying a numeric reason and optional message.

Fields

§flags: u8
§stream_id: u32
§reason_code: u16
§message: Option<String>
§

Unsubscribe

Channel unsubscription request carrying the subscription id.

Fields

§flags: u8
§stream_id: u32
§subscription_id: u64
§

Publish

Publish request carrying a channel and typed message envelope.

idempotency_key is Some only when the PUBLISH_IDEMPOTENCY_KEY_FLAG flag bit is set; it is the dedup-on-delivery key the server feeds to its dedup cache. When None (and the flag clear) the frame is byte-identical on the wire to a pre-13-L1 publish.

Fields

§flags: u8
§stream_id: u32
§channel: String
§idempotency_key: Option<String>
§

PublishAck

Publish success carrying the accepted message id.

Fields

§flags: u8
§stream_id: u32
§message_id: u64
§

PublishError

Publish failure carrying a numeric reason and optional message.

Fields

§flags: u8
§stream_id: u32
§reason_code: u16
§message: Option<String>
§

ConversationOpen

Conversation open carrying a conversation id and subject.

Fields

§flags: u8
§stream_id: u32
§conversation_id: u64
§subject: String
§

ConversationMessage

Conversation message carrying a conversation id and typed message envelope.

Fields

§flags: u8
§stream_id: u32
§conversation_id: u64
§

ConversationClose

Conversation close carrying a conversation id and optional reason.

Fields

§flags: u8
§stream_id: u32
§conversation_id: u64
§reason_code: Option<u16>
§message: Option<String>
§

ConversationError

Conversation failure carrying a conversation id, numeric reason, and optional message.

Fields

§flags: u8
§stream_id: u32
§conversation_id: u64
§reason_code: u16
§message: Option<String>
§

Accept

Backpressure acceptance for a delivered message.

Fields

§flags: u8
§stream_id: u32
§referenced_message_id: MessageId
§

Defer

Backpressure deferral for a buffered message.

Fields

§flags: u8
§stream_id: u32
§referenced_message_id: MessageId
§reason: Option<String>
§

Reject

Backpressure rejection for a shed message.

Fields

§flags: u8
§stream_id: u32
§referenced_message_id: MessageId
§reason: Option<String>
§

Ping

Connection keepalive ping.

Fields

§flags: u8
§

Pong

Connection keepalive pong.

Fields

§flags: u8
§

Push

Server-initiated push carrying a correlation id and an opaque payload.

A server writes this frame to a connected client over the client’s existing connection (server-to-client, the inverse of every other request frame). The correlation_id is the key the server uses to match the client’s later Frame::PushReply back to this push; the payload is opaque application bytes the server hands the client. This is an application-stream frame, so stream_id is non-zero like a publish or conversation message.

Fields

§flags: u8
§stream_id: u32
§correlation_id: u64
§payload: Vec<u8>
§

PushReply

Client-initiated correlated reply to a Frame::Push.

After handling a pushed frame the client writes this back on the same connection, echoing the push’s correlation_id so the server can match the reply to the originating push. The payload is the client’s opaque answer.

Fields

§flags: u8
§stream_id: u32
§correlation_id: u64
§payload: Vec<u8>
§

WorkerRegister

Worker self-registration over an established connection.

A worker sends this control frame (stream 0) after the connection handshake to announce its identity and routing dimensions. The server associates the registration with the connection’s process id and surfaces it to the application via the connection-notifier hook, then answers with a Frame::WorkerRegisterAck. node is optional locality and is encoded with a presence byte, never flattened to an empty string.

Fields

§flags: u8
§registration: WorkerRegistration
§

WorkerRegisterAck

Server acknowledgement of a Frame::WorkerRegister.

Carries the registration outcome: WorkerRegisterOutcome::Accepted when the server (and any configured notifier) accepted the worker, or WorkerRegisterOutcome::Rejected carrying a human-readable reason when it did not. The acknowledgement is synchronous so a worker never believes it is registered when the application rejected it.

Fields

§flags: u8
§

Unknown

Forward-compatible frame preserved after length-delimited skipping.

Fields

§type_id: u8
§flags: u8
§stream_id: u32
§payload: Vec<u8>

Implementations§

Source§

impl Frame

Source

pub fn new_ping(stream_id: u32) -> Result<Self, ProtocolError>

Construct a ping frame, enforcing the stream-0 control-frame invariant.

§Errors

Returns ProtocolError::InvalidStream when stream_id is not zero.

Source

pub fn new_publish( stream_id: u32, channel: impl Into<String>, envelope: MessageEnvelope, ) -> Result<Self, ProtocolError>

Construct a publish frame, enforcing the non-zero application-stream invariant.

§Errors

Returns ProtocolError::InvalidStream when stream_id is zero.

Source

pub fn new_publish_with_idempotency_key( stream_id: u32, channel: impl Into<String>, envelope: MessageEnvelope, idempotency_key: impl Into<String>, ) -> Result<Self, ProtocolError>

Construct a publish frame carrying an idempotency key for dedup-on-delivery.

The returned frame has PUBLISH_IDEMPOTENCY_KEY_FLAG set and serializes the trailing key field, so the server consults its dedup cache for this key.

§Errors

Returns ProtocolError::InvalidStream when stream_id is zero.

Source

pub fn new_push( stream_id: u32, correlation_id: u64, payload: Vec<u8>, ) -> Result<Self, ProtocolError>

Construct a server-to-client push frame, enforcing the non-zero application-stream invariant.

§Errors

Returns ProtocolError::InvalidStream when stream_id is zero.

Source

pub fn new_push_reply( stream_id: u32, correlation_id: u64, payload: Vec<u8>, ) -> Result<Self, ProtocolError>

Construct a client-to-server push reply frame, echoing the correlation id of the originating push, and enforcing the non-zero application-stream invariant.

§Errors

Returns ProtocolError::InvalidStream when stream_id is zero.

Source

pub const fn frame_type(&self) -> FrameType

Return the frame type represented by this frame body.

Source

pub const fn flags(&self) -> u8

Return the frame flags stored in the fixed header.

Source

pub const fn stream_id(&self) -> u32

Return the stream id stored in the fixed header.

Trait Implementations§

Source§

impl Clone for Frame

Source§

fn clone(&self) -> Frame

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 Frame

Source§

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

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

impl Eq for Frame

Source§

impl PartialEq for Frame

Source§

fn eq(&self, other: &Frame) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Frame

Auto Trait Implementations§

§

impl Freeze for Frame

§

impl RefUnwindSafe for Frame

§

impl Send for Frame

§

impl Sync for Frame

§

impl Unpin for Frame

§

impl UnsafeUnpin for Frame

§

impl UnwindSafe for Frame

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more