|
1 | 1 | use std::{collections::HashMap, future::Future, rc::Rc};
|
2 | 2 |
|
3 | 3 | use futures_util::future::LocalBoxFuture;
|
4 |
| -use matchit::{Match, Node}; |
| 4 | +use matchit::{Match, Router as MatchItRouter}; |
5 | 5 | use worker_kv::KvStore;
|
6 | 6 |
|
7 | 7 | use crate::{
|
@@ -43,8 +43,8 @@ impl<D> Clone for Handler<'_, D> {
|
43 | 43 |
|
44 | 44 | /// A path-based HTTP router supporting exact-match or wildcard placeholders and shared data.
|
45 | 45 | pub struct Router<'a, D> {
|
46 |
| - handlers: HashMap<Method, Node<Handler<'a, D>>>, |
47 |
| - or_else_any_method: Node<Handler<'a, D>>, |
| 46 | + handlers: HashMap<Method, MatchItRouter<Handler<'a, D>>>, |
| 47 | + or_else_any_method: MatchItRouter<Handler<'a, D>>, |
48 | 48 | data: D,
|
49 | 49 | }
|
50 | 50 |
|
@@ -126,7 +126,7 @@ impl<'a, D: 'a> Router<'a, D> {
|
126 | 126 | pub fn with_data(data: D) -> Self {
|
127 | 127 | Self {
|
128 | 128 | handlers: HashMap::new(),
|
129 |
| - or_else_any_method: Node::new(), |
| 129 | + or_else_any_method: MatchItRouter::new(), |
130 | 130 | data,
|
131 | 131 | }
|
132 | 132 | }
|
@@ -383,7 +383,7 @@ impl<'a, D: 'a> Router<'a, D> {
|
383 | 383 | }
|
384 | 384 | }
|
385 | 385 |
|
386 |
| -type NodeWithHandlers<'a, D> = Node<Handler<'a, D>>; |
| 386 | +type NodeWithHandlers<'a, D> = MatchItRouter<Handler<'a, D>>; |
387 | 387 |
|
388 | 388 | impl<'a, D: 'a> Router<'a, D> {
|
389 | 389 | fn split(
|
|
0 commit comments