[−][src]Struct router_rs::prelude::Route
A route specifies a path to match against. When a match is found a view_creator
is used
to return an impl View
that can be used to render the appropriate content for that route.
Methods
impl Route
[src]
pub fn new(
route_definition: &'static str,
route_param_parser: ParseRouteParam
) -> Route
[src]
route_definition: &'static str,
route_param_parser: ParseRouteParam
) -> Route
Create a new Route. You'll usually later call route.match(...) in order to see if a given the path in the browser URL matches your route's path definition.
impl Route
[src]
pub fn matches(&self, path: &str) -> bool
[src]
Determine whether or not our route matches a provided path.
Example
ⓘThis example is not tested
// path = "/food/:food_type" route.matches("/food/tacos");
pub fn view(&self, incoming_path: &str) -> VirtualNode
[src]
Given an incoming path, create the View
that uses that path data.
For example.. if our defined path is /users/:id
and our incoming path is /users/5
Our view will end up getting created with id: 5
pub fn find_route_param<'a>(
&self,
incoming_path: &'a str,
param_key: &str
) -> Option<&'a str>
[src]
&self,
incoming_path: &'a str,
param_key: &str
) -> Option<&'a str>
Given an incoming path and a param_key, get the RouteParam
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,