From 61e9fd9973a66e0cf6f08b4ec00736cefa8f0296 Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Tue, 18 Jul 2023 16:34:27 -0700 Subject: [PATCH] use :.. instead of :... --- docs/router/examples/catch_all.rs | 2 +- docs/router/examples/catch_all_segments.rs | 2 +- docs/router/examples/dynamic_route.rs | 2 +- docs/router/examples/full_example.rs | 2 +- docs/router/examples/links.rs | 2 +- docs/router/examples/navigator.rs | 2 +- docs/router/examples/nested_routes.rs | 2 +- examples/router.rs | 2 +- packages/router-macro/src/lib.rs | 4 ++-- packages/router-macro/src/route.rs | 6 +++--- packages/router-macro/src/segment.rs | 4 ++-- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/router/examples/catch_all.rs b/docs/router/examples/catch_all.rs index d55b8efcb..38dfa11f1 100644 --- a/docs/router/examples/catch_all.rs +++ b/docs/router/examples/catch_all.rs @@ -8,7 +8,7 @@ enum Route { #[route("/")] Home {}, // PageNotFound is a catch all route that will match any route and placing the matched segments in the route field - #[route("/:...route")] + #[route("/:..route")] PageNotFound { route: Vec }, } // ANCHOR_END: router diff --git a/docs/router/examples/catch_all_segments.rs b/docs/router/examples/catch_all_segments.rs index d4fcb5261..ce84a84db 100644 --- a/docs/router/examples/catch_all_segments.rs +++ b/docs/router/examples/catch_all_segments.rs @@ -7,7 +7,7 @@ use dioxus_router::prelude::*; #[rustfmt::skip] enum Route { // segments that start with :... are catch all segments - #[route("/blog/:...segments")] + #[route("/blog/:..segments")] BlogPost { // You must include catch all segment in child variants segments: Vec, diff --git a/docs/router/examples/dynamic_route.rs b/docs/router/examples/dynamic_route.rs index bb02e57b8..4ea5b3b45 100644 --- a/docs/router/examples/dynamic_route.rs +++ b/docs/router/examples/dynamic_route.rs @@ -26,7 +26,7 @@ enum Route { #[end_layout] #[end_nest] #[end_layout] - #[route("/:...route")] + #[route("/:..route")] PageNotFound { route: Vec, }, diff --git a/docs/router/examples/full_example.rs b/docs/router/examples/full_example.rs index 2f6251968..ff8302926 100644 --- a/docs/router/examples/full_example.rs +++ b/docs/router/examples/full_example.rs @@ -30,7 +30,7 @@ enum Route { #[redirect("/", || Route::BlogList {})] #[redirect("/:name", |name: String| Route::BlogPost { name })] #[end_nest] - #[route("/:...route")] + #[route("/:..route")] PageNotFound { route: Vec, }, diff --git a/docs/router/examples/links.rs b/docs/router/examples/links.rs index a84d50158..c74865927 100644 --- a/docs/router/examples/links.rs +++ b/docs/router/examples/links.rs @@ -11,7 +11,7 @@ enum Route { #[route("/")] Home {}, #[end_layout] - #[route("/:...route")] + #[route("/:..route")] PageNotFound { route: Vec }, } // ANCHOR_END: router diff --git a/docs/router/examples/navigator.rs b/docs/router/examples/navigator.rs index 786f832a4..4c6249366 100644 --- a/docs/router/examples/navigator.rs +++ b/docs/router/examples/navigator.rs @@ -7,7 +7,7 @@ use dioxus_router::prelude::*; enum Route { #[route("/")] Home {}, - #[route("/:...route")] + #[route("/:..route")] PageNotFound { route: Vec }, } diff --git a/docs/router/examples/nested_routes.rs b/docs/router/examples/nested_routes.rs index fa8c81494..7462d8e74 100644 --- a/docs/router/examples/nested_routes.rs +++ b/docs/router/examples/nested_routes.rs @@ -11,7 +11,7 @@ enum Route { #[route("/")] Home {}, #[end_layout] - #[route("/:...route")] + #[route("/:..route")] PageNotFound { route: Vec }, } // ANCHOR_END: router diff --git a/examples/router.rs b/examples/router.rs index 2f6251968..ff8302926 100644 --- a/examples/router.rs +++ b/examples/router.rs @@ -30,7 +30,7 @@ enum Route { #[redirect("/", || Route::BlogList {})] #[redirect("/:name", |name: String| Route::BlogPost { name })] #[end_nest] - #[route("/:...route")] + #[route("/:..route")] PageNotFound { route: Vec, }, diff --git a/packages/router-macro/src/lib.rs b/packages/router-macro/src/lib.rs index 5dada19cf..f8c9cff1d 100644 --- a/packages/router-macro/src/lib.rs +++ b/packages/router-macro/src/lib.rs @@ -31,11 +31,11 @@ mod segment; /// Route Segments: /// 1. Static Segments: "/static" /// 2. Dynamic Segments: "/:dynamic" (where dynamic has a type that is FromStr in all child Variants) -/// 3. Catch all Segments: "/:...segments" (where segments has a type that is FromSegments in all child Variants) +/// 3. Catch all Segments: "/:..segments" (where segments has a type that is FromSegments in all child Variants) /// 4. Query Segments: "/?:query" (where query has a type that is FromQuery in all child Variants) /// /// Routes are matched: -/// 1. By there specificity this order: Query Routes ("/?:query"), Static Routes ("/route"), Dynamic Routes ("/:route"), Catch All Routes ("/:...route") +/// 1. By there specificity this order: Query Routes ("/?:query"), Static Routes ("/route"), Dynamic Routes ("/:route"), Catch All Routes ("/:..route") /// 2. By the order they are defined in the enum /// /// All features: diff --git a/packages/router-macro/src/route.rs b/packages/router-macro/src/route.rs index 329a7c132..ad8c74857 100644 --- a/packages/router-macro/src/route.rs +++ b/packages/router-macro/src/route.rs @@ -126,7 +126,7 @@ impl Route { None => { return Err(syn::Error::new_spanned( variant.clone(), - "Routable variants with a #[child(...)] attribute must have a field named \"child\" or a field with a #[child] attribute", + "Routable variants with a #[child(..)] attribute must have a field named \"child\" or a field with a #[child] attribute", )); } } @@ -134,14 +134,14 @@ impl Route { _ => { return Err(syn::Error::new_spanned( variant.clone(), - "Routable variants with a #[child(...)] attribute must have named fields", + "Routable variants with a #[child(..)] attribute must have named fields", )) } } } else { return Err(syn::Error::new_spanned( variant.clone(), - "Routable variants must either have a #[route(...)] attribute or a #[child(...)] attribute", + "Routable variants must either have a #[route(..)] attribute or a #[child(..)] attribute", )); } } diff --git a/packages/router-macro/src/segment.rs b/packages/router-macro/src/segment.rs index 30b9e7e10..2f7455a3f 100644 --- a/packages/router-macro/src/segment.rs +++ b/packages/router-macro/src/segment.rs @@ -150,10 +150,10 @@ pub fn parse_route_segments<'a>( while let Some(segment) = iterator.next() { if let Some(segment) = segment.strip_prefix(':') { - let spread = segment.starts_with("..."); + let spread = segment.starts_with(".."); let ident = if spread { - segment[3..].to_string() + segment[2..].to_string() } else { segment.to_string() };