Skip to main content

RequestDecoder

Trait RequestDecoder 

Source
pub trait RequestDecoder: Send + Sync {
    type Event: AppEvent;

    // Required method
    fn decode(
        &self,
        bytes: &[u8],
        permission: Permission,
    ) -> Decoded<Self::Event>;
}
Expand description

Decode an authenticated client frame into an application event the runtime can publish to the pipeline.

Stateless on the connection (the runtime carries connection-level state — Permission, key_hash, etc. — and feeds the relevant piece in per call). Implementors are typically zero-sized types.

Required Associated Types§

Source

type Event: AppEvent

Application event type produced on a successful decode. The runtime wraps this in a transport-level envelope (e.g. JournalEvent::App) before publishing.

Required Methods§

Source

fn decode(&self, bytes: &[u8], permission: Permission) -> Decoded<Self::Event>

Decode a wire frame. bytes is the framed payload (length prefix already stripped by the caller). permission is the role established during the auth handshake and stored on the connection.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§