Skip to content

Commit

Permalink
fix nested apps
Browse files Browse the repository at this point in the history
  • Loading branch information
jbr committed Feb 21, 2021
1 parent 99a4057 commit c657b5f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name = "tide"
version = "0.16.0"
description = "A minimal and pragmatic Rust web application framework built for rapid development"
authors = [
"Aaron Turon <[email protected]>",
"Yoshua Wuyts <[email protected]>",
"Wonwoo Choi <[email protected]>",
"Aaron Turon <[email protected]>",
"Yoshua Wuyts <[email protected]>",
"Wonwoo Choi <[email protected]>",
]
documentation = "https://docs.rs/tide"
keywords = ["tide", "http", "web", "framework", "async"]
Expand Down Expand Up @@ -34,7 +34,7 @@ unstable = []

[dependencies]
async-h1 = { version = "2.3.0", optional = true }
async-session = { version = "2.0.1", optional = true }
async-session = { version = "2.0.1", optional = true }
async-sse = "4.0.1"
async-std = { version = "1.6.5", features = ["unstable"] }
async-trait = "0.1.41"
Expand All @@ -47,7 +47,7 @@ log = { version = "0.4.13", features = ["kv_unstable_std"] }
pin-project-lite = "0.2.0"
serde = "1.0.117"
serde_json = "1.0.59"
routefinder = "0.1.0"
routefinder = "0.1.1"

[dev-dependencies]
async-std = { version = "1.6.5", features = ["unstable", "attributes"] }
Expand Down
11 changes: 0 additions & 11 deletions src/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,6 @@ impl<'a, State: Clone + Send + Sync + 'static> Route<'a, State> {
pub fn method(&mut self, method: http_types::Method, ep: impl Endpoint<State>) -> &mut Self {
if self.prefix {
let ep = StripPrefixEndpoint::new(ep);

self.router.add(
&self.path,
method,
MiddlewareEndpoint::wrap_with_middleware(ep.clone(), &self.middleware),
);
let wildcard = self.at("*");
wildcard.router.add(
&wildcard.path,
Expand All @@ -181,11 +175,6 @@ impl<'a, State: Clone + Send + Sync + 'static> Route<'a, State> {
pub fn all(&mut self, ep: impl Endpoint<State>) -> &mut Self {
if self.prefix {
let ep = StripPrefixEndpoint::new(ep);

self.router.add_all(
&self.path,
MiddlewareEndpoint::wrap_with_middleware(ep.clone(), &self.middleware),
);
let wildcard = self.at("*");
wildcard.router.add_all(
&wildcard.path,
Expand Down
10 changes: 9 additions & 1 deletion src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ pub(crate) struct Router<State> {
all_method_router: MethodRouter<Box<DynEndpoint<State>>>,
}

impl<State> std::fmt::Debug for Router<State> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Router")
.field("method_map", &self.method_map)
.field("all_method_router", &self.all_method_router)
.finish()
}
}

/// The result of routing a URL
#[allow(missing_debug_implementations)]
pub(crate) struct Selection<'a, State> {
pub(crate) endpoint: &'a DynEndpoint<State>,
pub(crate) params: Captures,
Expand Down

0 comments on commit c657b5f

Please sign in to comment.