use :.. instead of :...

This commit is contained in:
Evan Almloff committed 2023-07-18 16:34:27 -07:00
1 parent f2c4233ef4
commit 61e9fd9973
11 files changed
+15 -15

No files matched your search

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