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
156
157
158
159
160
161
162
163
164
165
166
//! # Rapina
//!
//! A fast, type-safe web framework for Rust inspired by FastAPI.
//!
//! Rapina focuses on **productivity**, **type safety**, and **clear conventions**,
//! making it easy to build production-ready APIs.
//!
//! ## Features
//!
//! - **Type-safe extractors** - Parse request data with compile-time guarantees
//! - **Declarative routing** - Use proc macros like `#[get]`, `#[post]` for clean route definitions
//! - **Middleware system** - Composable middleware with async support
//! - **Structured errors** - Standardized error responses with `trace_id` for debugging
//! - **Validation** - Built-in request validation using the `validator` crate
//! - **Observability** - Integrated tracing for structured logging
//!
//! ## Quick Start
//!
//! ```rust,ignore
//! use rapina::prelude::*;
//!
//! #[get("/")]
//! async fn hello() -> &'static str {
//! "Hello, Rapina!"
//! }
//!
//! #[get("/users/:id")]
//! async fn get_user(id: Path<u64>) -> Result<Json<serde_json::Value>> {
//! let id = id.into_inner();
//! Ok(Json(serde_json::json!({ "id": id })))
//! }
//!
//! #[tokio::main]
//! async fn main() -> std::io::Result<()> {
//! let router = Router::new()
//! .get("/", hello)
//! .get("/users/:id", get_user);
//!
//! Rapina::new()
//! .router(router)
//! .listen("127.0.0.1:3000")
//! .await
//! }
//! ```
//!
//! ## Extractors
//!
//! Rapina provides several extractors for parsing request data:
//!
//! - [`Json`](extract::Json) - Parse JSON request bodies
//! - [`Path`](extract::Path) - Extract path parameters
//! - [`Query`](extract::Query) - Parse query string parameters
//! - [`Form`](extract::Form) - Parse URL-encoded form data
//! - [`Headers`](extract::Headers) - Access request headers
//! - [`Cookie`](extract::Cookie) - Extract and deserialize cookies
//! - [`State`](extract::State) - Access application state
//! - [`Context`](extract::Context) - Access request context with trace_id
//! - [`Validated`](extract::Validated) - Validate extracted data
//!
//! ## Middleware
//!
//! Built-in middleware for common use cases:
//!
//! - [`TimeoutMiddleware`](middleware::TimeoutMiddleware) - Request timeout handling
//! - [`BodyLimitMiddleware`](middleware::BodyLimitMiddleware) - Limit request body size
//! - [`TraceIdMiddleware`](middleware::TraceIdMiddleware) - Add trace IDs to requests
//! - [`RequestLogMiddleware`](middleware::RequestLogMiddleware) - Structured request logging
//! - [`RateLimitMiddleware`](middleware::RateLimitMiddleware) - Token bucket rate limiting
//!
//! ## Introspection
//!
//! Access route metadata for documentation and tooling:
//!
//! - [`RouteInfo`](introspection::RouteInfo) - Metadata about registered routes
//!
//! ## Testing
//!
//! Integration testing utilities:
//!
//! - [`TestClient`](testing::TestClient) - Test client for integration testing
/// Convenient re-exports for common Rapina types.
///
/// This module re-exports the most commonly used types so you can
/// import everything you need with a single `use` statement:
///
/// ```
/// use rapina::prelude::*;
/// ```
// Re-export proc macros at crate root so they work as rapina::schema!, rapina::get!, etc.
pub use ;
// Re-export dependencies so users don't need to add them to their Cargo.toml
pub use http;
pub use hyper;
pub use rust_decimal;
pub use schemars;
pub use uuid;
pub use inventory;
// Re-export sea-orm when database feature is enabled
pub use async_trait;
pub use sea_orm;
pub use sea_orm_migration;