This page is a quick-reference index — click through to docs.rs for the complete method-level API. Module paths are relative to rust_web_server::; a feature in parentheses means the item is compiled only with that Cargo feature.
Trait implemented by all app types: execute(&Request, &ConnectionInfo) -> Result<Response, String>. runs_inline(request, connection) (default false) lets the async servers run a request on the event loop instead of the blocking pool — only for work that never waits. See Async handlers
AsyncResponse
application (http2)
Return type of the optional Application::execute_async, awaited on the connection's task instead of holding a blocking-pool thread
Controller
controller
Trait with is_matching(request, connection) and process(request, response, connection). See Controllers
App
app
Zero-config application with all built-in controllers. App::with_config(ServerConfig) pins it to a fixed config (no env reads per request — the lock-free pattern for parallel tests)
AppWithState<S>
state
State-aware app with .get/.post/.put/.patch/.delete route builders; state shared as Arc<S>. Entry point App::with_state(S); .with_config(ServerConfig) pins the fallback App. See State
AsyncAppWithState<S>
async_state (http2)
Same with async fn handlers. Entry point App::with_async_state(S)
Middleware
middleware
Layer trait: handle(request, connection, next). runs_inline / is_passthrough (default false) declare a layer non-blocking or a no-op for a request. See Middleware
WithMiddleware<A>
middleware
Wraps any Application with a layer stack; app.wrap(layer), first-pushed is outermost
Container
di
TypeId-keyed dependency injection container: register::<T>, provide::<dyn Trait>, *_named, get. Pass it directly to App::with_state(container) — not into_arc(), which double-wraps. See Dependency injection
TeraEngine
template (tera)
Jinja2-style templates: from_dir, from_raw; global template::init(dir) / template::render(name, &ctx) / template::reload() (also run on SIGHUP). See Templates
Parsed HTTP request: method, URI, version, headers, body bytes. request.header(name) is a case-insensitive, allocation-free lookup; Request::is_supported_method checks a method token
Response
response
HTTP response: status code, headers, body as Vec<ContentRange>. Response::json(status, bytes) / Response::text(status, &str) are one-line builders; response.header(name) looks a header up
STATUS_CODE_REASON_PHRASE
response
Every HTTP status code as a typed constant
Header
header
Name/value pair (Cow<'static, str> fields since 18.0.0; build with Header::new(name, value), read via deref); constants for all standard header names. See Migrating to 18.0
HTTP
http
Version constants; HTTP::is_supported_version
MimeType
mime_type
MIME type constants and detection from a file extension
Range / ContentRange
range
Byte ranges and the body parts of a Response (bytes, files, multipart)
URL
url
Parse and build URLs; percent-encode/decode
FormUrlEncoded
body::form_urlencoded
Parses application/x-www-form-urlencoded bodies. See Forms & uploads
Path-pattern router with :param and *wildcard; .with_host(name) restricts it to one virtual host; .matches(request, connection) tells whether handle() would run a handler
TCP listener, thread pool, TLS acceptor, and request loop. Server::continue_response / expectation_failed_response implement Expect: 100-continue / 417 on HTTP/1.1
server::REQUEST_HEAD_TIMEOUT
server
30 s: a request head must complete within this of its first byte, else 408
ServerConfig
server_config
Typed snapshot of per-instance config (CORS, CSP, client_hints, static_cache_control, log format). ServerConfig::current() is the shared per-request snapshot; call server_config::invalidate() after a direct std::env::set_var
ConfigSnapshot
config_reload
Hot-reloadable values, read with config_reload::current(). See Hot reload
config_reload::reload / config_reload::on_reload
config_reload
Re-read rws.config.toml (also on SIGHUP and POST /admin/config/reload); register a closure run after every reload
ConfigReport
config_check
Result of config_check::check_file / check_str (what rws --check runs): errors, warnings, .is_ok(), .render(path), .render_json(path). See Config file
get_max_body_size
entry_point
Reads RWS_CONFIG_MAX_BODY_SIZE_IN_BYTES (default 0, unlimited); larger requests get 413 before buffering
Sliding-window per-key limiter; rate_limit::global() for the singleton; .retry_after() / .limits(). See Rate limiting
RedisRateLimiter
rate_limit
Fixed-window limiter shared across instances through Redis; from_env()
RateLimitLayer
middleware
Enforces the global rate limiter per client IP; 429 with Retry-After
CacheLayer
cache
In-memory TTL response cache for GET (CacheLayer::memory(n).ttl(s).vary_by_header(h)); skips no-store/private/no-cache, Range and out-of-key Vary responses. See Caching
MetricsLayer
metrics
Per-route Prometheus counters and latency histograms. See Metrics
RewriteLayer
rewrite
Request/response header, URI, body, and status rewriting; .request_uri_regex_rewrite needs rewrite-regex. See Rewrite
BasicAuthLayer
auth (auth)
HTTP Basic authentication via a closure or from_htpasswd_file (plain or rws's {SHA256} scheme — not Apache {SHA}/$apr1$/bcrypt). See Auth
JwtLayer
auth (auth)
HS256 Bearer JWT validation; ::rs256/::es256 verify against a static public key (auth-asymmetric)
ForwardAuthLayer
auth::forward (auth)
Delegates allow/deny to an external HTTP service; verbatim pass-through on non-2xx, 502 if unreachable
IpFilter
ip_filter
IPv4/IPv6 address or CIDR allowlist/denylist; ip_filter::is_valid_entry checks an entry. See IP filter
Provider endpoints; same presets plus OidcProvider::discover(issuer)
OidcClaims
sso (sso)
Standard OIDC claims from a verified id_token or UserInfo response (no groups)
JwksCache
sso (sso)
JWKS key cache; verify_jwt(token, &VerifyOptions) checks RS256/ES256 signature, exp, iss, aud; refetches once on a key miss
VerifyOptions
sso (sso)
audience, issuer, leeway_secs for JwksCache::verify_jwt
OidcClient
sso (sso)
authorization_url, exchange_code, fetch_user_info
TokenResponse
sso (sso)
Token endpoint response returned by exchange_code
PkceVerifier
sso (sso)
RFC 7636 code verifier; .challenge()
PkceChallenge
sso (sso)
S256 code challenge for the authorization URL
AuthServer
sso (sso-server)
rws as an OAuth 2.0 Authorization Server (/oauth/token, /oauth/authorize, discovery). Tokens are HS256, so jwks.json is always empty; /oauth/authorize trusts an existing app session, with no built-in login page
HTTP/1.1 reverse proxy middleware: round-robin with failover (502 when all fail), pooled connections, unbuffered streaming of SSE/chunked/large bodies; .with_circuit_breaker(Arc<dyn Breaker>). See Reverse proxy
LoadBalancing
proxy
Strategy enum passed to ReverseProxy::strategy()
ConnPool / Pool<S>
proxy
Per-backend idle-connection pool (ConnPool = Pool<TcpStream>); ConnPool::new(max_idle, idle_timeout), share with ReverseProxy::with_pool. A stale pooled connection is retried once only for idempotent methods
UpstreamTls
proxy
Trusts a PEM CA file for https:// backends instead of WebPKI (ReverseProxy::tls_ca_file, [[upstream]] tls_ca_file); unloadable file → 502
All model-layer types need model-sqlite, model-postgres or model-mysql (each implies http2; they combine).
Type / Trait
Module
Description
DbPool
model
Async sqlx pool, one variant per compiled-in backend: new(DbConfig), from_env(), memory() (SQLite :memory:); execute, query, begin, transaction, migrate. See Database
DbTransaction
model
Open transaction from DbPool::begin; commit / rollback
DbConfig
model
Connection settings; from_env() reads RWS_DB_*
Backend
model
Sqlite, Postgres, MySql (compiled-in only); Backend::parse; pick it explicitly only with several backends compiled in
In-process test client — dispatches requests without a TCP socket. See TestClient
OpenApiConfig / build_spec
openapi (openapi)
OpenAPI 3.0 from registered routes; AppWithState::openapi(config) adds /openapi.json and /docs. Paths, methods and path parameters only — no body schemas. See OpenAPI
AcmeConfig
acme (acme)
ACME / Let's Encrypt settings; AcmeConfig::from_env() reads RWS_CONFIG_ACME_*. See ACME
AcmeManager
acme (acme)
HTTP-01 provisioning and renewal: .provision_until_ready().await, .run_renewal_loop()
Feature flags
Items marked with a feature in parentheses compile only with that Cargo feature. See Features and Cargo.toml for the full list.