[][src]Struct router_xiaobei::prelude::Route

pub struct Route { /* fields omitted */ }

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]

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 find_route_param<'a>(
    &self,
    incoming_path: &'a str,
    param_key: &str
) -> Option<&'a str>
[src]

Given an incoming path and a param_key, get the RouteParam

Trait Implementations

impl Debug for Route[src]

Auto Trait Implementations

impl !Send for Route

impl !Sync for Route

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.