pub fn into_shadow_matcher_tokens(
        self,
        id: usize,
        encountered_query: &mut bool,
    ) -> Vec<ShadowMatcherToken> {
        match self {
            AttrToken::To(matcher_string) => {
                yew_router_route_parser::parse_str_and_optimize_tokens(&matcher_string)
                    .expect("Invalid Matcher") // This is the point where users should see an error message if their matcher string has some syntax error.
                    .into_iter()
                    .map(crate::switch::shadow::ShadowMatcherToken::from)
                    .collect()
            }
            AttrToken::Lit(lit) => vec![ShadowMatcherToken::Exact(format!("/{}", lit))],
            AttrToken::Capture(Some(capture_name)) => vec![
                ShadowMatcherToken::Exact("/".to_string()),
                ShadowMatcherToken::Capture(ShadowCaptureVariant::Named(capture_name)),
            ],
            AttrToken::Capture(None) => vec![
                ShadowMatcherToken::Exact("/".to_string()),
                ShadowMatcherToken::Capture(ShadowCaptureVariant::Named(id.to_string())),
            ],
            AttrToken::End => unimplemented!(
                "No matcher token currently exists for expressing the termination of a route"
            ),
            AttrToken::Rest(Some(capture_name)) => vec![ShadowMatcherToken::Capture(
                ShadowCaptureVariant::ManyNamed(capture_name),
            )],
            AttrToken::Rest(None) => vec![ShadowMatcherToken::Capture(
                ShadowCaptureVariant::ManyNamed(id.to_string()),
            )],
            AttrToken::Query(capture_name) => {
                if *encountered_query {
                    vec![
                        ShadowMatcherToken::Exact(format!("&{}=", capture_name)),
                        ShadowMatcherToken::Capture(ShadowCaptureVariant::Named(capture_name)),
                    ]
                } else {
                    *encountered_query = true;
                    vec![
                        ShadowMatcherToken::Exact(format!("?{}=", capture_name)),
                        ShadowMatcherToken::Capture(ShadowCaptureVariant::Named(capture_name)),
                    ]
                }
            }
            AttrToken::Frag(Some(capture_name)) => vec![
                ShadowMatcherToken::Exact("#".to_string()),
                ShadowMatcherToken::Capture(ShadowCaptureVariant::Named(capture_name)),
            ],
            AttrToken::Frag(None) => vec![
                ShadowMatcherToken::Exact("#".to_string()),
                ShadowMatcherToken::Capture(ShadowCaptureVariant::Named(id.to_string())),
            ],
        }
    }
/// The id is an unique identifier that allows otherwise unnamed captures to still be captured
/// with unique names.
The id is an unique identifier that allows otherwise unnamed captures to still be captured
with unique names.
The id is an unique identifier that allows otherwise unnamed captures to still be captured with unique names .
pub fn into_shadow_matcher_tokens(
        self,
        id: usize,
        encountered_query: &mut bool,
    ) -> Vec<ShadowMatcherToken> {
        match self {
            AttrToken::To(matcher_string) => {
                yew_router_route_parser::parse_str_and_optimize_tokens(&matcher_string)
                    .expect("Invalid Matcher") // This is the point where users should see an error message if their matcher string has some syntax error.
                    .into_iter()
                    .map(crate::switch::shadow::ShadowMatcherToken::from)
                    .collect()
            }
            AttrToken::Lit(lit) => vec![ShadowMatcherToken::Exact(format!("/{}", lit))],
            AttrToken::Capture(Some(capture_name)) => vec![
                ShadowMatcherToken::Exact("/".to_string()),
                ShadowMatcherToken::Capture(ShadowCaptureVariant::Named(capture_name)),
            ],
            AttrToken::Capture(None) => vec![
                ShadowMatcherToken::Exact("/".to_string()),
                ShadowMatcherToken::Capture(ShadowCaptureVariant::Named(id.to_string())),
            ],
            AttrToken::End => unimplemented!(
                "No matcher token currently exists for expressing the termination of a route"
            ),
            AttrToken::Rest(Some(capture_name)) => vec![ShadowMatcherToken::Capture(
                ShadowCaptureVariant::ManyNamed(capture_name),
            )],
            AttrToken::Rest(None) => vec![ShadowMatcherToken::Capture(
                ShadowCaptureVariant::ManyNamed(id.to_string()),
            )],
            AttrToken::Query(capture_name) => {
                if *encountered_query {
                    vec![
                        ShadowMatcherToken::Exact(format!("&{}=", capture_name)),
                        ShadowMatcherToken::Capture(ShadowCaptureVariant::Named(capture_name)),
                    ]
                } else {
                    *encountered_query = true;
                    vec![
                        ShadowMatcherToken::Exact(format!("?{}=", capture_name)),
                        ShadowMatcherToken::Capture(ShadowCaptureVariant::Named(capture_name)),
                    ]
                }
            }
            AttrToken::Frag(Some(capture_name)) => vec![
                ShadowMatcherToken::Exact("#".to_string()),
                ShadowMatcherToken::Capture(ShadowCaptureVariant::Named(capture_name)),
            ],
            AttrToken::Frag(None) => vec![
                ShadowMatcherToken::Exact("#".to_string()),
                ShadowMatcherToken::Capture(ShadowCaptureVariant::Named(id.to_string())),
            ],
        }
    }
pub fn into_shadow_matcher_tokens ( self , id : usize , encountered_query : & mut bool , ) -> Vec < ShadowMatcherToken > { match self { AttrToken :: To ( matcher_string ) => { yew_router_route_parser :: parse_str_and_optimize_tokens ( & matcher_string ) . expect ( " " ) // This is the point where users should see an error message if their matcher string has some syntax error. . into_iter ( ) . map ( crate :: switch :: shadow :: ShadowMatcherToken :: from ) . collect ( ) } AttrToken :: Lit ( lit ) => vec ! [ ShadowMatcherToken Exact ( format ( " " lit ) ) ] , AttrToken :: Capture ( Some ( capture_name ) ) => vec ! [ ShadowMatcherToken Exact ( " " to_string ( ) ) ShadowMatcherToken Capture ( ShadowCaptureVariant Named ( capture_name ) ) ] , AttrToken :: Capture ( None ) => vec ! [ ShadowMatcherToken Exact ( " " to_string ( ) ) ShadowMatcherToken Capture ( ShadowCaptureVariant Named ( id to_string ( ) ) ) ] , AttrToken :: End => unimplemented ! ( " " ) , AttrToken :: Rest ( Some ( capture_name ) ) => vec ! [ ShadowMatcherToken Capture ( ShadowCaptureVariant ManyNamed ( capture_name ) ) ] , AttrToken :: Rest ( None ) => vec ! [ ShadowMatcherToken Capture ( ShadowCaptureVariant ManyNamed ( id to_string ( ) ) ) ] , AttrToken :: Query ( capture_name ) => { if * encountered_query { vec ! [ ShadowMatcherToken Exact ( format ( " " capture_name ) ) ShadowMatcherToken Capture ( ShadowCaptureVariant Named ( capture_name ) ) ] } else { * encountered_query = true ; vec ! [ ShadowMatcherToken Exact ( format ( " " capture_name ) ) ShadowMatcherToken Capture ( ShadowCaptureVariant Named ( capture_name ) ) ] } } AttrToken :: Frag ( Some ( capture_name ) ) => vec ! [ ShadowMatcherToken Exact ( " " to_string ( ) ) ShadowMatcherToken Capture ( ShadowCaptureVariant Named ( capture_name ) ) ] , AttrToken :: Frag ( None ) => vec ! [ ShadowMatcherToken Exact ( " " to_string ( ) ) ShadowMatcherToken Capture ( ShadowCaptureVariant Named ( id to_string ( ) ) ) ] , } }
The id is an unique identifier that allows otherwise unnamed captures to still be captured
with unique names.
The id is an unique identifier that allows otherwise unnamed captures to still be captured with unique names .
self
id
usize
encountered_query
&mut bool
self
id
usize
encountered_query
&mut bool