Evan Almloff 1 год назад
Родитель
Сommit
61e9fd9973

+ 1 - 1
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<String> },
 }
 // ANCHOR_END: router

+ 1 - 1
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<String>,

+ 1 - 1
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<String>,
     },

+ 1 - 1
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<String>,
     },

+ 1 - 1
docs/router/examples/links.rs

@@ -11,7 +11,7 @@ enum Route {
         #[route("/")]
         Home {},
     #[end_layout]
-    #[route("/:...route")]
+    #[route("/:..route")]
     PageNotFound { route: Vec<String> },
 }
 // ANCHOR_END: router

+ 1 - 1
docs/router/examples/navigator.rs

@@ -7,7 +7,7 @@ use dioxus_router::prelude::*;
 enum Route {
     #[route("/")]
     Home {},
-    #[route("/:...route")]
+    #[route("/:..route")]
     PageNotFound { route: Vec<String> },
 }
 

+ 1 - 1
docs/router/examples/nested_routes.rs

@@ -11,7 +11,7 @@ enum Route {
         #[route("/")]
         Home {},
     #[end_layout]
-    #[route("/:...route")]
+    #[route("/:..route")]
     PageNotFound { route: Vec<String> },
 }
 // ANCHOR_END: router

+ 1 - 1
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<String>,
     },

+ 2 - 2
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:

+ 3 - 3
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",
                         ));
                 }
             }

+ 2 - 2
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()
             };