allow nested routes
This commit is contained in:
1 parent
6569827b97
commit
2da1f7faa7
6 files changed
+346
-172
No files matched your search
@@ -25,6 +25,7 @@ where
|
||||
let mut full_path = String::new();
|
||||
for segment in &route {
|
||||
match segment {
|
||||
SegmentType::Child => {}
|
||||
SegmentType::Static(s) => {
|
||||
full_path += "/";
|
||||
full_path += s;
|
||||
@@ -43,6 +44,7 @@ where
|
||||
render_route(renderer, route, &mut tokio::io::sink(), |_| {}).await?;
|
||||
}
|
||||
Err(e) => {
|
||||
log::info!("@ route: {}", full_path);
|
||||
log::error!("Error pre-caching static route: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,12 +172,15 @@ pub enum SegmentType {
|
||||
Dynamic(&'static str),
|
||||
/// A catch all route segment
|
||||
CatchAll(&'static str),
|
||||
/// A child router
|
||||
Child,
|
||||
}
|
||||
|
||||
impl Display for SegmentType {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match &self {
|
||||
SegmentType::Static(s) => write!(f, "/{}", s),
|
||||
SegmentType::Child => Ok(()),
|
||||
SegmentType::Dynamic(s) => write!(f, "/:{}", s),
|
||||
SegmentType::CatchAll(s) => write!(f, "/:...{}", s),
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user