@@ -9,38 +9,38 @@ use crate::{Request, Response, StatusCode};
9
9
/// Internally, we have a separate state machine per http method; indexing
10
10
/// by the method first allows the table itself to be more efficient.
11
11
#[ allow( missing_debug_implementations) ]
12
- pub struct Router < State > {
12
+ pub ( crate ) struct Router < State > {
13
13
method_map : HashMap < http_types:: Method , MethodRouter < Box < DynEndpoint < State > > > > ,
14
14
all_method_router : MethodRouter < Box < DynEndpoint < State > > > ,
15
15
}
16
16
17
17
/// The result of routing a URL
18
18
#[ allow( missing_debug_implementations) ]
19
- pub struct Selection < ' a , State > {
19
+ pub ( crate ) struct Selection < ' a , State > {
20
20
pub ( crate ) endpoint : & ' a DynEndpoint < State > ,
21
21
pub ( crate ) params : Params ,
22
22
}
23
23
24
24
impl < State : Clone + Send + Sync + ' static > Router < State > {
25
- pub fn new ( ) -> Self {
25
+ pub ( crate ) fn new ( ) -> Self {
26
26
Router {
27
27
method_map : HashMap :: default ( ) ,
28
28
all_method_router : MethodRouter :: new ( ) ,
29
29
}
30
30
}
31
31
32
- pub fn add ( & mut self , path : & str , method : http_types:: Method , ep : Box < DynEndpoint < State > > ) {
32
+ pub ( crate ) fn add ( & mut self , path : & str , method : http_types:: Method , ep : Box < DynEndpoint < State > > ) {
33
33
self . method_map
34
34
. entry ( method)
35
35
. or_insert_with ( MethodRouter :: new)
36
36
. add ( path, ep)
37
37
}
38
38
39
- pub fn add_all ( & mut self , path : & str , ep : Box < DynEndpoint < State > > ) {
39
+ pub ( crate ) fn add_all ( & mut self , path : & str , ep : Box < DynEndpoint < State > > ) {
40
40
self . all_method_router . add ( path, ep)
41
41
}
42
42
43
- pub fn route ( & self , path : & str , method : http_types:: Method ) -> Selection < ' _ , State > {
43
+ pub ( crate ) fn route ( & self , path : & str , method : http_types:: Method ) -> Selection < ' _ , State > {
44
44
if let Some ( Match { handler, params } ) = self
45
45
. method_map
46
46
. get ( & method)
0 commit comments