Trait yew_router::Routable

source ·
pub trait Routable: Clone + PartialEq {
    fn from_path(path: &str, params: &HashMap<&str, &str>) -> Option<Self>;
    fn to_path(&self) -> String;
    fn routes() -> Vec<&'static str> ;
    fn not_found_route() -> Option<Self>;
    fn recognize(pathname: &str) -> Option<Self>;
}
Expand description

Marks an enum as routable.

Implementation

Use derive macro to implement it. Although it is possible to implement it manually, it is discouraged.

Usage

The functions exposed by this trait are not supposed to be consumed directly. Instead use the functions exposed at the crate’s root to perform operations with the router.

Required Methods§

Converts path to an instance of the routes enum.

Converts the route to a string that can passed to the history API.

Lists all the available routes

The route to redirect to on 404

Match a route based on the path

Implementors§