Module tonic::transport

source ·
Expand description

Batteries included server and client.

This module provides a set of batteries included, fully featured and fast set of HTTP/2 server and client’s. These components each provide a or rustls tls backend when the respective feature flag is enabled, and provides builders to configure transport behavior.


  • TLS support via rustls.
  • Load balancing
  • Timeouts
  • Concurrency Limits
  • Rate limiting



let cert = std::fs::read_to_string("ca.pem")?;

let mut channel = Channel::from_static("")
    .rate_limit(5, Duration::from_secs(1))


let cert = std::fs::read_to_string("server.pem")?;
let key = std::fs::read_to_string("server.key")?;

let addr = "[::1]:50051".parse()?;

        .identity(Identity::from_pem(&cert, &key)))?


  • Client implementation and builder.
  • Server implementation and builder.


  • A stream of Bytes, used when receiving bodies.
  • Represents a X509 certificate.
  • A default batteries included transport channel.
  • Channel builder.
  • Error’s that originate from the client or server;
  • A default batteries included transport server.
  • Error returned if a request didn’t complete within the configured timeout.
  • The URI component of a request.


  • A trait to provide a static reference to the service’s name. This is used for routing service’s within the router.