Skip to main content

TranscodeState

Trait TranscodeState 

Source
pub trait TranscodeState:
    Clone
    + Send
    + Sync
    + 'static {
    type Upstream: Upstream;

    // Required methods
    fn into_upstream(self) -> Self::Upstream;
    fn forwarded_headers(&self) -> &[String];
    fn sse_keep_alive_secs(&self) -> u64;
}
Expand description

Trait for state types that support REST→gRPC transcoding.

Implement this for your application’s state type to use transcode::routes(). Provides the minimal interface needed by transcode handlers. Each request works on its own clone of the state, so a clone should be cheap.

Required Associated Types§

Source

type Upstream: Upstream

The gRPC service transcoded calls go to.

Required Methods§

Source

fn into_upstream(self) -> Self::Upstream

The upstream, taken out of this request’s clone of the state.

Source

fn forwarded_headers(&self) -> &[String]

Headers to forward from HTTP to gRPC metadata.

Source

fn sse_keep_alive_secs(&self) -> u64

SSE keep-alive interval (seconds) for server-streaming responses.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§