File tree Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 29
29
30
30
- ** Fast** : See benchmark
31
31
32
- - ** Micro** : The [ src/lib.rs] ( src/lib.rs ) file is ~ 407 lines of code (Includes comments)
32
+ - ** Micro** : The [ src/lib.rs] ( src/lib.rs ) file is ~ 405 lines of code (Includes comments)
33
33
34
34
- ** Flexible** :
35
35
Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ impl<T> Node<T> {
193
193
NodeKind :: Static ( ref s) => {
194
194
let l = loc ( s, p) ;
195
195
196
- if l == 0 || l < s. len ( ) {
196
+ if l < s. len ( ) {
197
197
None
198
198
} else if l == s. len ( ) && l == p. len ( ) {
199
199
Some (
@@ -297,7 +297,7 @@ impl<T> PathTree<T> {
297
297
#[ inline]
298
298
pub fn new ( ) -> Self {
299
299
Self {
300
- root : Node :: new ( NodeKind :: Static ( "/ " . to_owned ( ) ) ) ,
300
+ root : Node :: new ( NodeKind :: Static ( "" . to_owned ( ) ) ) ,
301
301
params : 0 ,
302
302
}
303
303
}
@@ -310,8 +310,6 @@ impl<T> PathTree<T> {
310
310
311
311
let mut most = 0 ;
312
312
313
- path = path. trim_start_matches ( '/' ) ;
314
-
315
313
if path. is_empty ( ) {
316
314
node. data . replace ( data) ;
317
315
return self ;
Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ use rand::seq::SliceRandom;
5
5
fn new_tree ( ) {
6
6
let mut tree: PathTree < usize > = PathTree :: default ( ) ;
7
7
8
- const ROUTES : [ & str ; 13 ] = [
8
+ const ROUTES : [ & str ; 14 ] = [
9
+ "" ,
9
10
"/" ,
10
11
"/users" ,
11
12
"/users/:id" ,
@@ -21,7 +22,8 @@ fn new_tree() {
21
22
"/users/repos/*any" ,
22
23
] ;
23
24
24
- const VALID_URLS : [ & str ; 13 ] = [
25
+ const VALID_URLS : [ & str ; 14 ] = [
26
+ "" ,
25
27
"/" ,
26
28
"/users" ,
27
29
"/users/fundon" ,
@@ -38,6 +40,7 @@ fn new_tree() {
38
40
] ;
39
41
40
42
let valid_res = vec ! [
43
+ vec![ ] ,
41
44
vec![ ] ,
42
45
vec![ ] ,
43
46
vec![ ( "id" , "fundon" ) ] ,
You can’t perform that action at this time.
0 commit comments