1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//! Extra middleware and utilities for the Salvo web framework.
//!
//! This crate provides a collection of commonly-needed web features as middleware
//! and utilities that complement Salvo's core functionality. All features are
//! opt-in through feature flags, allowing you to include only what you need.
//!
//! # Quick Start
//!
//! Add `salvo_extra` to your `Cargo.toml` with the features you need:
//!
//! ```toml
//! [dependencies]
//! salvo_extra = { version = "0.88", features = ["basic-auth", "websocket"] }
//! ```
//!
//! Or use the `salvo` umbrella crate which re-exports these features:
//!
//! ```toml
//! [dependencies]
//! salvo = { version = "0.88", features = ["basic-auth", "websocket"] }
//! ```
//!
//! # Feature Categories
//!
//! ## Authentication & Security
//!
//! | Feature | Description |
//! |---------|-------------|
//! | [`basic-auth`](basic_auth) | HTTP Basic Authentication (RFC 7617) |
//! | [`force-https`](force_https) | Redirect HTTP requests to HTTPS |
//!
//! ## Request/Response Processing
//!
//! | Feature | Description |
//! |---------|-------------|
//! | [`caching-headers`](caching_headers) | Add cache control headers |
//! | [`size-limiter`](size_limiter) | Limit request body size |
//! | [`timeout`] | Set request processing timeout |
//! | [`trailing-slash`](trailing_slash) | Normalize URL trailing slashes |
//!
//! ## Concurrency & Resource Management
//!
//! | Feature | Description |
//! |---------|-------------|
//! | [`concurrency-limiter`](concurrency_limiter) | Limit concurrent requests |
//! | [`affix-state`](affix_state) | Attach shared state to requests |
//!
//! ## Observability
//!
//! | Feature | Description |
//! |---------|-------------|
//! | [`logging`] | Request/response logging |
//! | [`request-id`](request_id) | Unique request ID generation |
//!
//! ## Real-time Communication
//!
//! | Feature | Description |
//! |---------|-------------|
//! | [`sse`] | Server-Sent Events for streaming updates |
//! | [`websocket`] | Full-duplex WebSocket connections |
//!
//! ## Error Handling & Integration
//!
//! | Feature | Description |
//! |---------|-------------|
//! | [`catch-panic`](catch_panic) | Convert panics to error responses |
//! | [`tower-compat`](tower_compat) | Use Tower middleware with Salvo |
//!
//! # Usage Example
//!
//! ```ignore
//! use salvo::prelude::*;
//! use salvo_extra::basic_auth::{BasicAuth, BasicAuthValidator};
//! use salvo_extra::logging::Logger;
//! use salvo_extra::timeout::Timeout;
//! use std::time::Duration;
//!
//! // Apply multiple middleware
//! let router = Router::new()
//! .hoop(Logger::new())
//! .hoop(Timeout::new(Duration::from_secs(30)))
//! .push(
//! Router::with_path("api")
//! .hoop(BasicAuth::new(MyValidator))
//! .get(my_handler)
//! );
//! ```
cfg_feature!
cfg_feature!
cfg_feature!
cfg_feature!
cfg_feature!
cfg_feature!
cfg_feature!
cfg_feature!
cfg_feature!
cfg_feature!
cfg_feature!
cfg_feature!
cfg_feature!
cfg_feature!