Skip to main content

Crate salvo

Crate salvo 

Source
Expand description

Salvo is a powerful web framework that can make your work easier.

salvo uses a set of [feature flags] to reduce the amount of compiled and optional dependencies.

§Feature flags

FeatureDescriptionDefault?
cookieSupport for Cookie✔️
serverBuilt-in Server implementation✔️
server-handleExpose a ServerHandle for graceful/forced shutdown✔️
http1Support for HTTP 1.1 protocol✔️
http2Support for HTTP 2 protocol✔️
http2-cleartextSupport for HTTP 2 over cleartext TCP
quinnUse quinn to support HTTP 3 protocol
testUtilities for testing application✔️
acmeAutomatically obtain certificates through ACME
rustlsTLS built on rustls
opensslTLS built on openssl-tls
native-tlsTLS built on native-tls
tls12Allow TLS 1.2 (in addition to 1.3) for the rustls backend
aws-lc-rsUse aws-lc-rs as the rustls crypto provider✔️
ringUse ring as the rustls crypto provider
unixListener based on Unix socket
socket2Tune listener socket options via socket2
fix-http1-request-uriRewrite HTTP/1.1 absolute-form request URIs to origin-form✔️
matched-pathExpose the matched route template on the request✔️
tower-compatAdapters for tower::Layer and tower::Service
anyhowIntegrate with the anyhow crate
eyreIntegrate with the eyre crate
affix-stateMiddleware for adding shared application state to the request context
craftGenerate handlers or endpoints with shared data
basic-authMiddleware for basic authentication
caching-headersMiddleware for setting caching headers
catch-panicMiddleware for catching panics
concurrency-limiterMiddleware for limiting concurrency
force-httpsMiddleware for forcing HTTPS
loggingMiddleware for logging requests and responses
request-idMiddleware for setting a request ID
size-limiterMiddleware for limiting request size
sseServer-Sent Events (SSE) middleware
timeoutMiddleware for setting a timeout
trailing-slashMiddleware for handling trailing slashes
websocketWebSocket implementation
cacheResponse caching middleware
compressionResponse compression middleware
corsCORS middleware
csrfCSRF protection middleware
flashFlash messages middleware
jwt-authJWT authentication middleware
oapiOpenAPI 3 generation and Swagger/RapiDoc/ReDoc/Scalar UIs
otelOpenTelemetry integration
proxyReverse-proxy middleware
rate-limiterRate-limiting middleware
serve-staticStatic file / directory serving
sessionCookie-based session middleware
tustus.io resumable upload protocol

Re-exports§

pub use salvo_cache as cache;cache
pub use salvo_compression as compression;compression
pub use salvo_cors as cors;cors
pub use salvo_csrf as csrf;csrf
pub use salvo_flash as flash;flash
pub use salvo_jwt_auth as jwt_auth;_jwt-auth
pub use salvo_proxy as proxy;proxy
pub use salvo_rate_limiter as rate_limiter;rate-limiter
pub use salvo_session as session;session
pub use salvo_serve_static as serve_static;serve-static
pub use salvo_otel as otel;otel
pub use salvo_acme as acme;acme
pub use salvo_oapi as oapi;oapi
pub use salvo_tus as tus;tus
pub use salvo_core as core;
pub use salvo_craft as craft;craft

Modules§

affix_stateaffix-state
Middleware for adding shared application state to the request context.
basic_authbasic-auth
Middleware for HTTP Basic Authentication.
caching_headerscaching-headers
Middleware for handling ETag and Last-Modified headers.
catch_paniccatch-panic
Middleware that catches panics in handlers.
catcher
Error catching and custom error page handling.
concurrency_limiterconcurrency-limiter
Middleware for limiting concurrency.
conn
Connection and listener implementations for handling HTTP connections.
extract
Request extraction for deserializing request data into application types.
force_httpsforce-https
Middleware force redirect to https.
fs
Filesystem utilities for serving files in HTTP responses.
fuse
Low-overhead protection against stalled and abusive connections.
handler
Handler abstractions for processing Request values.
http
HTTP types, request/response handling, and protocol utilities.
hyper
hyper
logginglogging
A simple logging middleware.
macros
Procedural macros for the Salvo web framework.
prelude
A list of things that automatically imports into application use salvo.
proto
Http protocol supports.
request_idrequest-id
Request id middleware.
routing
Routing and filters.
rt
Runtime module.
serverserver
Server module
size_limitersize-limiter
Middleware for limiting request size.
ssesse
Middleware for Server-Sent Events (SSE)
testtest
Utilities for testing application.
timeouttimeout
Middleware for controlling requests timeout.
trailing_slashtrailing-slash
Trailing slash middleware.
websocketwebsocket
WebSocket implementation.
writing
Writer trait and its implementations.

Structs§

ConnCtrl
Controls the lifetime of the transport connection serving a request.
Depot
Store temporary data for the current request.
FlowCtrl
Controls execution of a matched handler chain.
Request
Represents an HTTP request.
Response
Represents an HTTP response.
Router
Route request to different handlers.
Server
HTTP Server.
Service
Service http request.

Enums§

Error
The main error type used throughout Salvo.

Traits§

Extractible
Describes how to extract a type from a request.
Handler
Processes a request and writes to a response.
Listener
A trait for types that can bind to an address and create an acceptor.
Scribe
Scribe is used to write data to Response.
Writer
Writer is used to write data to Response.

Type Aliases§

BoxedError
A boxed error type for dynamic error handling.
Result
Result type which has salvo::Error as its error type.

Attribute Macros§

async_trait
handler
Converts a function or impl block into a Salvo Handler.