Cargo Features

[dependencies]
tonic = { version = "0.13.0", default-features = false, features = ["codegen", "deflate", "zstd", "prost", "tls-ring", "tls-aws-lc", "tls-native-roots", "tls-webpki-roots", "router", "server", "channel", "transport"] }
default = codegen, prost, router, transport

These default features are set whenever tonic is added without default-features = false somewhere in the dependency tree.

codegen default

Enables async-trait

Affects tonic::codegen

gzip deflate

Enables flate2

compression

zstd

Enables zstd

prost default

Enables prost

_tls-any tls-aws-lc? tls-native-roots? tls-ring? tls-webpki-roots?

Internal. Please choose one of tls-ring or tls-aws-lc

Enables tokio-rustls, macros and rt of tokio

Affects conn::TlsConnectInfo

tls-ring = _tls-any

Enables ring of tokio-rustls

tls-aws-lc = _tls-any

Enables aws-lc-rs of tokio-rustls

tokio-rustls:

Alias because Cargo features commonly use -

tls-native-roots = _tls-any, channel

Enables rustls-native-certs

rustls

tls-webpki-roots = _tls-any, channel

Enables webpki-roots

router default

Enables axum, util of tower

Affects server::Router

server transport

Enables socket2, server of hyper, server-auto and service of hyper-util, macros, net and time of tokio, net of tokio-stream, limit and util of tower and h2

transport

Affects transport::server, tonic::transport

channel tls-native-roots? tls-webpki-roots? transport

Enables hyper-timeout, client-legacy of hyper-util, time of tokio, balance, buffer, discover, limit and util of tower and client of hyper

hyper:

Client/Server

Affects transport::channel, tonic::transport

transport default = channel, server

Features from optional dependencies

harness = false