Skip to main content

Upstream

Trait Upstream 

Source
pub trait Upstream:
    GrpcService<Body, ResponseBody: Body<Data = Bytes, Error: Into<BoxError> + Send> + Send + 'static, Error: Into<BoxError>, Future: Send>
    + Clone
    + Send
    + Sync
    + 'static { }
Expand description

A gRPC service the proxy can call: a remote Channel, tonic::service::Routes, or any other tower::Service<http::Request<tonic::body::Body>> answering with a gRPC response. Implemented for every such service; there is nothing to implement by hand.

An in-process upstream sees a transcoded call exactly as it sees a native gRPC request: through its whole stack, interceptors and layers included.

§Examples

use structured_proxy::upstream::Upstream;

fn accepts<U: Upstream>(_upstream: U) {}

// An empty set of tonic services answers every call with UNIMPLEMENTED.
accepts(tonic::service::Routes::default());

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T> Upstream for T
where T: GrpcService<Body, ResponseBody: Body<Data = Bytes, Error: Into<BoxError> + Send> + Send + 'static, Error: Into<BoxError>, Future: Send> + Clone + Send + Sync + 'static,