Trait yew_router::Routable
source · pub trait Routable: Clone + PartialEq {
// Required methods
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§
sourcefn from_path(path: &str, params: &HashMap<&str, &str>) -> Option<Self>
fn from_path(path: &str, params: &HashMap<&str, &str>) -> Option<Self>
Converts path to an instance of the routes enum.
sourcefn not_found_route() -> Option<Self>
fn not_found_route() -> Option<Self>
The route to redirect to on 404
Object Safety§
This trait is not object safe.