1use crate::Router;
6
7pub struct RouterBuilder<S = ()> {
9 _marker: std::marker::PhantomData<S>,
11}
12
13impl<S> RouterBuilder<S>
14where
15 S: Clone + Send + Sync + 'static,
16{
17 pub fn new() -> Self
19 where
20 S: Default,
21 {
22 Self { _marker: std::marker::PhantomData }
23 }
24
25 pub fn from_router(_router: Router) -> Self {
27 Self { _marker: std::marker::PhantomData }
28 }
29
30 pub fn route(self, _path: &str, _method_router: MethodRouter<S>) -> Self {
32 self
33 }
34
35 pub fn nest(self, _path: &str, _router: Router) -> Self {
37 self
38 }
39
40 pub fn merge(self, _router: Router) -> Self {
42 self
43 }
44
45 pub fn get<H, T>(self, _path: &str, _handler: H) -> Self
47 where
48 T: 'static,
49 {
50 self
51 }
52
53 pub fn post<H, T>(self, _path: &str, _handler: H) -> Self
55 where
56 T: 'static,
57 {
58 self
59 }
60
61 pub fn put<H, T>(self, _path: &str, _handler: H) -> Self
63 where
64 T: 'static,
65 {
66 self
67 }
68
69 pub fn delete<H, T>(self, _path: &str, _handler: H) -> Self
71 where
72 T: 'static,
73 {
74 self
75 }
76
77 pub fn patch<H, T>(self, _path: &str, _handler: H) -> Self
79 where
80 T: 'static,
81 {
82 self
83 }
84
85 pub fn options<H, T>(self, _path: &str, _handler: H) -> Self
87 where
88 T: 'static,
89 {
90 self
91 }
92
93 pub fn head<H, T>(self, _path: &str, _handler: H) -> Self
95 where
96 T: 'static,
97 {
98 self
99 }
100
101 pub fn trace<H, T>(self, _path: &str, _handler: H) -> Self
103 where
104 T: 'static,
105 {
106 self
107 }
108
109 pub fn build(self) -> Router {
111 Router::new()
112 }
113
114 pub fn into_inner(self) -> Router {
116 self.build()
117 }
118}
119
120impl<S> Default for RouterBuilder<S>
121where
122 S: Clone + Send + Sync + 'static + Default,
123{
124 fn default() -> Self {
125 Self::new()
126 }
127}
128
129impl<S> From<Router> for RouterBuilder<S>
130where
131 S: Clone + Send + Sync + 'static,
132{
133 fn from(router: Router) -> Self {
134 Self::from_router(router)
135 }
136}
137
138impl<S> From<RouterBuilder<S>> for Router
139where
140 S: Clone + Send + Sync + 'static,
141{
142 fn from(builder: RouterBuilder<S>) -> Self {
143 builder.build()
144 }
145}
146
147pub struct MethodRouter<S = ()> {
149 _marker: std::marker::PhantomData<S>,
150}
151
152impl<S> Clone for MethodRouter<S> {
153 fn clone(&self) -> Self {
154 Self { _marker: std::marker::PhantomData }
155 }
156}
157
158impl<S> Default for MethodRouter<S> {
159 fn default() -> Self {
160 Self { _marker: std::marker::PhantomData }
161 }
162}
163
164pub fn get<H, T, S>(_handler: H) -> MethodRouter<S>
166where
167 T: 'static,
168{
169 MethodRouter::default()
170}
171
172pub fn post<H, T, S>(_handler: H) -> MethodRouter<S>
174where
175 T: 'static,
176{
177 MethodRouter::default()
178}
179
180pub fn put<H, T, S>(_handler: H) -> MethodRouter<S>
182where
183 T: 'static,
184{
185 MethodRouter::default()
186}
187
188pub fn delete<H, T, S>(_handler: H) -> MethodRouter<S>
190where
191 T: 'static,
192{
193 MethodRouter::default()
194}
195
196pub fn patch<H, T, S>(_handler: H) -> MethodRouter<S>
198where
199 T: 'static,
200{
201 MethodRouter::default()
202}
203
204pub fn options<H, T, S>(_handler: H) -> MethodRouter<S>
206where
207 T: 'static,
208{
209 MethodRouter::default()
210}
211
212pub fn head<H, T, S>(_handler: H) -> MethodRouter<S>
214where
215 T: 'static,
216{
217 MethodRouter::default()
218}
219
220pub fn trace<H, T, S>(_handler: H) -> MethodRouter<S>
222where
223 T: 'static,
224{
225 MethodRouter::default()
226}
227
228pub fn health_check_router() -> Router {
230 Router::new()
231}