Skip to main content

BidiBinding

Trait BidiBinding 

Source
pub trait BidiBinding: Send + 'static {
    type Request: Send + 'static;
    type Response: Send + 'static;
    type Mutate: Send;
    type GroupMessage: MaybeSend + MaybeSync;
    type WelcomeMessage: MaybeSend + MaybeSync;

    // Required methods
    fn mutate_frame(mutate: Self::Mutate) -> Self::Request;
    fn ping_frame(nonce: u64) -> Self::Request;
    fn pong_frame(nonce: u64) -> Self::Request;
    fn handle(
        response: Self::Response,
    ) -> Inbound<Self::GroupMessage, Self::WelcomeMessage>;
}
Expand description

Backend-specific wire vocabulary for a bidi subscription. The control core is generic over this: a binding names the wire request/response types and the per-backend Mutate and message types, builds outbound frames, and — via BidiBinding::handle — classifies an inbound response into an Inbound instruction.

Required Associated Types§

Source

type Request: Send + 'static

Outbound wire frame (client → server).

Source

type Response: Send + 'static

Inbound wire frame (server → client).

Source

type Mutate: Send

The backend update payload.

Source

type GroupMessage: MaybeSend + MaybeSync

Encrypted group envelope for the consumer.

Source

type WelcomeMessage: MaybeSend + MaybeSync

Encrypted welcome envelope for the consumer.

Required Methods§

Source

fn mutate_frame(mutate: Self::Mutate) -> Self::Request

Wrap a Mutate as an outbound request frame.

Source

fn ping_frame(nonce: u64) -> Self::Request

A client Ping request frame (liveness probe).

Source

fn pong_frame(nonce: u64) -> Self::Request

A Pong request frame answering a server Ping.

Source

fn handle( response: Self::Response, ) -> Inbound<Self::GroupMessage, Self::WelcomeMessage>

Classify one inbound response into an actor instruction. An associated fn, like the frame constructors: bindings are stateless by design — any stateful ordering or cursor tracking belongs to the consumer, not a single connection actor.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§