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
167
168
169
170
171
172
173
//! # HTTP Server Library
//!
//! A lightweight, asynchronous HTTP server framework built with Tokio.
//!
//! This library provides core components for building HTTP servers with support for:
//! - HTTP request/response parsing
//! - Routing with various pattern matching types
//! - Guard middleware system for request validation
//! - Asynchronous request handling
//!
//! ## Key Features
//! - **Async-first**: Built on Tokio for high-performance async I/O
//! - **Flexible Routing**: Supports exact, parameterized, and wildcard routes
//! - **Middleware Guards**: Chainable guards for authentication and validation
//! - **Type Safety**: Leverages Rust's type system for compile-time safety
//!
//! ## Modules
//! - `request`: HTTP request parsing and structures
//! - `response`: HTTP response building and serialization
//! - `server`: Main HTTP server implementation
//! - `handler`: Request handler and routing system
//! - `guard`: Guard middleware for request validation
//! - `route`: Route pattern matching components
pub use *;
pub use HeaderMap;
use crateFuError;
// impl ConvertFromRefString<i32> for &String {
// fn convert(self) -> Result<i32,String> {
// self.parse::<i32>().map_err(|_|"convert error!".to_string())
// }
// }
// #[deprecated]
// #[macro_export]
// macro_rules! impl_convert_from_ref_string {
// ($($t:ty),*) => {
// $(
// impl <'a> $crate::request::ConvertFromRefString<'a,$t> for &String {
// fn convert(self) -> Result<$t,String> {
// self.parse::<$t>().map_err(|_|format!("can not convert {} to {}",self,stringify!($t)))
// }
// }
// )*
// };
// }
// impl From<&HttpHeader> for Bytes {
// fn from(value: &HttpHeader) -> Self {
// let mut b = BytesMut::with_capacity(256);
// for (k, v) in value.headers.iter() {
// b.put(format!("{k}:{v}\r\n").as_bytes());
// }
// b.put("\r\n".as_bytes());
// b.freeze()
// }
// }
/// please impl `TryConvertFrom`