Cargo Features

[dependencies]
tonic = { version = "0.12.3", default-features = false, features = ["codegen", "gzip", "zstd", "prost", "tls", "tls-roots", "tls-native-roots", "tls-webpki-roots", "router", "server", "channel", "transport"] }
default = codegen, prost, 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

Enables flate2

compression

zstd

Enables zstd

prost default

Enables prost

tls tls-native-roots? tls-webpki-roots?

Enables tokio-rustls, macros and rt of tokio and rustls-pemfile

rustls

Affects conn::TlsConnectInfo

tls-roots = tls-native-roots

Deprecated. Please use tls-native-roots instead.

tls-native-roots tls-roots? = channel, tls

Enables rustls-native-certs

tls-webpki-roots = channel, tls

Enables webpki-roots

router server?

Enables axum, util of tower ^0.4.7

server transport = router

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 ^0.4.7 and async-stream and h2

async-stream:

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 ^0.4.7 and client of hyper

hyper:

Client/Server

Affects transport::channel, tonic::transport

transport default = channel, server

Features from optional dependencies

harness = false