Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Feature flags

The rama crate is one crate with many optional parts. Each protocol, transport and backend is behind a cargo feature, so you only compile what you use.

By default only the std feature is enabled, which gives you the service and layer abstractions but no network stack. Enable the features for the parts you need. A minimal HTTP server over TCP:

cargo add rama --features http-backend,tcp
cargo add tokio --features macros,rt-multi-thread

A minimal HTTP client (EasyHttpWebClient), with Rustls on aws-lc for https:

cargo add rama --features http-backend,tcp,dns,rustls,aws-lc
cargo add tokio --features macros,rt-multi-thread

Use boring instead of rustls,aws-lc for the BoringSSL backend. Add quic (with a TLS backend) for HTTP/3. http-full enables the full HTTP stack, including HTTP/3, WebSocket and compression. See the [features] table in Cargo.toml for all features.

Feature groups

AreaFeatures
Transportstcp, udp, unix, quic (needs a TLS backend)
TLStls, with a backend: rustls (plus aws-lc or ring) or boring; acme
DNSdns, dns-hickory
HTTPhttp, http-backend, http-full, ws, multipart, html, rss, http-hyperium
RPC and gatewaysgrpc, grpc-full, ttrpc, fastcgi, icap
Proxiesproxy, socks5, haproxy, masque, pac, proxy-memory-db, proxy-csv, proxy-live-update, proxy-full
Scriptingjs, js-interpreter, js-disk-cache
Inspection and emulationinspect, ua, ua-embed-profiles
Platformnet-apple-networkextension, net-apple-xpc
Observabilityopentelemetry, dial9
Interoptower

Features pull in what they need: pac enables js, dns and http, and masque enables http, udp and dns. The API docs on docs.rs are built with all features and mark each item with the features it needs.