fn transition(self, token: RouteParserToken<'a>) -> Result<Self, ParserError> {
        match self {
            ParserState::None => match token {
                RouteParserToken::Separator => Ok(ParserState::Path { prev_token: token }),
                RouteParserToken::Exact(_) => Err(ParserError::NotAllowedStateTransition),
                RouteParserToken::Capture(_) => Ok(ParserState::Path { prev_token: token }), /* TODO revise decision to allow this state transform for _all_ capture variants. */
                RouteParserToken::QueryBegin => Ok(ParserState::FirstQuery { prev_token: token }),
                RouteParserToken::QuerySeparator => Err(ParserError::NotAllowedStateTransition),
                RouteParserToken::QueryCapture { .. } => Err(ParserError::NotAllowedStateTransition),
                RouteParserToken::FragmentBegin => Ok(ParserState::Fragment { prev_token: token }),
                RouteParserToken::End => Err(ParserError::NotAllowedStateTransition),
            },
            ParserState::Path { prev_token } => {
                match prev_token {
                    RouteParserToken::Separator => match token {
                        RouteParserToken::Exact(_) | RouteParserToken::Capture(_) => {
                            Ok(ParserState::Path { prev_token: token })
                        }
                        RouteParserToken::QueryBegin => {
                            Ok(ParserState::FirstQuery { prev_token: token })
                        }
                        RouteParserToken::FragmentBegin => {
                            Ok(ParserState::Fragment { prev_token: token })
                        }
                        RouteParserToken::End => Ok(ParserState::End),
                        _ => Err(ParserError::NotAllowedStateTransition),
                    },
                    RouteParserToken::Exact(_) => match token {
                        RouteParserToken::Separator | RouteParserToken::Capture(_) => {
                            Ok(ParserState::Path { prev_token: token })
                        }
                        RouteParserToken::QueryBegin => {
                            Ok(ParserState::FirstQuery { prev_token: token })
                        }
                        RouteParserToken::FragmentBegin => {
                            Ok(ParserState::Fragment { prev_token: token })
                        }
                        RouteParserToken::End => Ok(ParserState::End),
                        _ => Err(ParserError::NotAllowedStateTransition),
                    },
                    RouteParserToken::Capture(_) => match token {
                        RouteParserToken::Separator | RouteParserToken::Exact(_) => {
                            Ok(ParserState::Path { prev_token: token })
                        }
                        RouteParserToken::QueryBegin => {
                            Ok(ParserState::FirstQuery { prev_token: token })
                        }
                        RouteParserToken::FragmentBegin => {
                            Ok(ParserState::Fragment { prev_token: token })
                        }
                        RouteParserToken::End => Ok(ParserState::End),
                        _ => Err(ParserError::NotAllowedStateTransition),
                    },
                    _ => Err(ParserError::InvalidState), /* Other previous token types are
                                                          * invalid within a Path state. */
                }
            }
            ParserState::FirstQuery { prev_token } => match prev_token {
                RouteParserToken::QueryBegin => match token {
                    RouteParserToken::QueryCapture { .. } => {
                        Ok(ParserState::FirstQuery { prev_token: token })
                    }
                    _ => Err(ParserError::NotAllowedStateTransition),
                },
                RouteParserToken::QueryCapture { .. } => match token {
                    RouteParserToken::QuerySeparator => {
                        Ok(ParserState::NthQuery { prev_token: token })
                    }
                    RouteParserToken::FragmentBegin => {
                        Ok(ParserState::Fragment { prev_token: token })
                    }
                    RouteParserToken::End => Ok(ParserState::End),
                    _ => Err(ParserError::NotAllowedStateTransition),
                },
                _ => Err(ParserError::InvalidState),
            },
            ParserState::NthQuery { prev_token } => match prev_token {
                RouteParserToken::QuerySeparator => match token {
                    RouteParserToken::QueryCapture { .. } => {
                        Ok(ParserState::NthQuery { prev_token: token })
                    }
                    _ => Err(ParserError::NotAllowedStateTransition),
                },
                RouteParserToken::QueryCapture { .. } => match token {
                    RouteParserToken::QuerySeparator => {
                        Ok(ParserState::NthQuery { prev_token: token })
                    }
                    RouteParserToken::FragmentBegin => {
                        Ok(ParserState::Fragment { prev_token: token })
                    }
                    RouteParserToken::End => Ok(ParserState::End),
                    _ => Err(ParserError::NotAllowedStateTransition),
                },
                _ => Err(ParserError::InvalidState),
            },
            ParserState::Fragment { prev_token } => match prev_token {
                RouteParserToken::FragmentBegin
                | RouteParserToken::Exact(_)
                | RouteParserToken::Capture(_) => Ok(ParserState::Fragment { prev_token: token }),
                RouteParserToken::End => Ok(ParserState::End),
                _ => Err(ParserError::InvalidState),
            },
            ParserState::End => Err(ParserError::TokensAfterEndToken),
        }
    }
/// Given a new route parser token, transition to a new state.
///
/// This will set the prev token to a token able to be handled by the new state,
/// so the new state does not need to handle arbitrary "from" states.
///
/// This function represents the valid state transition graph.
Given a new route parser token, transition to a new state.
This will set the prev token to a token able to be handled by the new state,
so the new state does not need to handle arbitrary "from" states.

This function represents the valid state transition graph.
Given a new route parser token transition to a new state . This will set the prev token to a token able to be handled by the new state so the new state does not need to handle arbitrary " from " states . This function represents the valid state transition graph .
fn transition(self, token: RouteParserToken<'a>) -> Result<Self, ParserError> {
        match self {
            ParserState::None => match token {
                RouteParserToken::Separator => Ok(ParserState::Path { prev_token: token }),
                RouteParserToken::Exact(_) => Err(ParserError::NotAllowedStateTransition),
                RouteParserToken::Capture(_) => Ok(ParserState::Path { prev_token: token }), /* TODO revise decision to allow this state transform for _all_ capture variants. */
                RouteParserToken::QueryBegin => Ok(ParserState::FirstQuery { prev_token: token }),
                RouteParserToken::QuerySeparator => Err(ParserError::NotAllowedStateTransition),
                RouteParserToken::QueryCapture { .. } => Err(ParserError::NotAllowedStateTransition),
                RouteParserToken::FragmentBegin => Ok(ParserState::Fragment { prev_token: token }),
                RouteParserToken::End => Err(ParserError::NotAllowedStateTransition),
            },
            ParserState::Path { prev_token } => {
                match prev_token {
                    RouteParserToken::Separator => match token {
                        RouteParserToken::Exact(_) | RouteParserToken::Capture(_) => {
                            Ok(ParserState::Path { prev_token: token })
                        }
                        RouteParserToken::QueryBegin => {
                            Ok(ParserState::FirstQuery { prev_token: token })
                        }
                        RouteParserToken::FragmentBegin => {
                            Ok(ParserState::Fragment { prev_token: token })
                        }
                        RouteParserToken::End => Ok(ParserState::End),
                        _ => Err(ParserError::NotAllowedStateTransition),
                    },
                    RouteParserToken::Exact(_) => match token {
                        RouteParserToken::Separator | RouteParserToken::Capture(_) => {
                            Ok(ParserState::Path { prev_token: token })
                        }
                        RouteParserToken::QueryBegin => {
                            Ok(ParserState::FirstQuery { prev_token: token })
                        }
                        RouteParserToken::FragmentBegin => {
                            Ok(ParserState::Fragment { prev_token: token })
                        }
                        RouteParserToken::End => Ok(ParserState::End),
                        _ => Err(ParserError::NotAllowedStateTransition),
                    },
                    RouteParserToken::Capture(_) => match token {
                        RouteParserToken::Separator | RouteParserToken::Exact(_) => {
                            Ok(ParserState::Path { prev_token: token })
                        }
                        RouteParserToken::QueryBegin => {
                            Ok(ParserState::FirstQuery { prev_token: token })
                        }
                        RouteParserToken::FragmentBegin => {
                            Ok(ParserState::Fragment { prev_token: token })
                        }
                        RouteParserToken::End => Ok(ParserState::End),
                        _ => Err(ParserError::NotAllowedStateTransition),
                    },
                    _ => Err(ParserError::InvalidState), /* Other previous token types are
                                                          * invalid within a Path state. */
                }
            }
            ParserState::FirstQuery { prev_token } => match prev_token {
                RouteParserToken::QueryBegin => match token {
                    RouteParserToken::QueryCapture { .. } => {
                        Ok(ParserState::FirstQuery { prev_token: token })
                    }
                    _ => Err(ParserError::NotAllowedStateTransition),
                },
                RouteParserToken::QueryCapture { .. } => match token {
                    RouteParserToken::QuerySeparator => {
                        Ok(ParserState::NthQuery { prev_token: token })
                    }
                    RouteParserToken::FragmentBegin => {
                        Ok(ParserState::Fragment { prev_token: token })
                    }
                    RouteParserToken::End => Ok(ParserState::End),
                    _ => Err(ParserError::NotAllowedStateTransition),
                },
                _ => Err(ParserError::InvalidState),
            },
            ParserState::NthQuery { prev_token } => match prev_token {
                RouteParserToken::QuerySeparator => match token {
                    RouteParserToken::QueryCapture { .. } => {
                        Ok(ParserState::NthQuery { prev_token: token })
                    }
                    _ => Err(ParserError::NotAllowedStateTransition),
                },
                RouteParserToken::QueryCapture { .. } => match token {
                    RouteParserToken::QuerySeparator => {
                        Ok(ParserState::NthQuery { prev_token: token })
                    }
                    RouteParserToken::FragmentBegin => {
                        Ok(ParserState::Fragment { prev_token: token })
                    }
                    RouteParserToken::End => Ok(ParserState::End),
                    _ => Err(ParserError::NotAllowedStateTransition),
                },
                _ => Err(ParserError::InvalidState),
            },
            ParserState::Fragment { prev_token } => match prev_token {
                RouteParserToken::FragmentBegin
                | RouteParserToken::Exact(_)
                | RouteParserToken::Capture(_) => Ok(ParserState::Fragment { prev_token: token }),
                RouteParserToken::End => Ok(ParserState::End),
                _ => Err(ParserError::InvalidState),
            },
            ParserState::End => Err(ParserError::TokensAfterEndToken),
        }
    }
fn transition ( self , token : RouteParserToken < ' a > ) -> Result < Self , ParserError > { match self { ParserState :: None => match token { RouteParserToken :: Separator => Ok ( ParserState :: Path { prev_token : token } ) , RouteParserToken :: Exact ( _ ) => Err ( ParserError :: NotAllowedStateTransition ) , RouteParserToken :: Capture ( _ ) => Ok ( ParserState :: Path { prev_token : token } ) , /* TODO revise decision to allow this state transform for _all_ capture variants. */ RouteParserToken :: QueryBegin => Ok ( ParserState :: FirstQuery { prev_token : token } ) , RouteParserToken :: QuerySeparator => Err ( ParserError :: NotAllowedStateTransition ) , RouteParserToken :: QueryCapture { .. } => Err ( ParserError :: NotAllowedStateTransition ) , RouteParserToken :: FragmentBegin => Ok ( ParserState :: Fragment { prev_token : token } ) , RouteParserToken :: End => Err ( ParserError :: NotAllowedStateTransition ) , } , ParserState :: Path { prev_token } => { match prev_token { RouteParserToken :: Separator => match token { RouteParserToken :: Exact ( _ ) | RouteParserToken :: Capture ( _ ) => { Ok ( ParserState :: Path { prev_token : token } ) } RouteParserToken :: QueryBegin => { Ok ( ParserState :: FirstQuery { prev_token : token } ) } RouteParserToken :: FragmentBegin => { Ok ( ParserState :: Fragment { prev_token : token } ) } RouteParserToken :: End => Ok ( ParserState :: End ) , _ => Err ( ParserError :: NotAllowedStateTransition ) , } , RouteParserToken :: Exact ( _ ) => match token { RouteParserToken :: Separator | RouteParserToken :: Capture ( _ ) => { Ok ( ParserState :: Path { prev_token : token } ) } RouteParserToken :: QueryBegin => { Ok ( ParserState :: FirstQuery { prev_token : token } ) } RouteParserToken :: FragmentBegin => { Ok ( ParserState :: Fragment { prev_token : token } ) } RouteParserToken :: End => Ok ( ParserState :: End ) , _ => Err ( ParserError :: NotAllowedStateTransition ) , } , RouteParserToken :: Capture ( _ ) => match token { RouteParserToken :: Separator | RouteParserToken :: Exact ( _ ) => { Ok ( ParserState :: Path { prev_token : token } ) } RouteParserToken :: QueryBegin => { Ok ( ParserState :: FirstQuery { prev_token : token } ) } RouteParserToken :: FragmentBegin => { Ok ( ParserState :: Fragment { prev_token : token } ) } RouteParserToken :: End => Ok ( ParserState :: End ) , _ => Err ( ParserError :: NotAllowedStateTransition ) , } , _ => Err ( ParserError :: InvalidState ) , /* Other previous token types are
                                                          * invalid within a Path state. */ } } ParserState :: FirstQuery { prev_token } => match prev_token { RouteParserToken :: QueryBegin => match token { RouteParserToken :: QueryCapture { .. } => { Ok ( ParserState :: FirstQuery { prev_token : token } ) } _ => Err ( ParserError :: NotAllowedStateTransition ) , } , RouteParserToken :: QueryCapture { .. } => match token { RouteParserToken :: QuerySeparator => { Ok ( ParserState :: NthQuery { prev_token : token } ) } RouteParserToken :: FragmentBegin => { Ok ( ParserState :: Fragment { prev_token : token } ) } RouteParserToken :: End => Ok ( ParserState :: End ) , _ => Err ( ParserError :: NotAllowedStateTransition ) , } , _ => Err ( ParserError :: InvalidState ) , } , ParserState :: NthQuery { prev_token } => match prev_token { RouteParserToken :: QuerySeparator => match token { RouteParserToken :: QueryCapture { .. } => { Ok ( ParserState :: NthQuery { prev_token : token } ) } _ => Err ( ParserError :: NotAllowedStateTransition ) , } , RouteParserToken :: QueryCapture { .. } => match token { RouteParserToken :: QuerySeparator => { Ok ( ParserState :: NthQuery { prev_token : token } ) } RouteParserToken :: FragmentBegin => { Ok ( ParserState :: Fragment { prev_token : token } ) } RouteParserToken :: End => Ok ( ParserState :: End ) , _ => Err ( ParserError :: NotAllowedStateTransition ) , } , _ => Err ( ParserError :: InvalidState ) , } , ParserState :: Fragment { prev_token } => match prev_token { RouteParserToken :: FragmentBegin | RouteParserToken :: Exact ( _ ) | RouteParserToken :: Capture ( _ ) => Ok ( ParserState :: Fragment { prev_token : token } ) , RouteParserToken :: End => Ok ( ParserState :: End ) , _ => Err ( ParserError :: InvalidState ) , } , ParserState :: End => Err ( ParserError :: TokensAfterEndToken ) , } }
Given a new route parser token, transition to a new state.
Given a new route parser token transition to a new state .
self
token
RouteParserToken<'a>
self
token
RouteParserToken<'a>