[−][src]Struct vial::prelude::Router
Router
keeps track of all the routes defined by
vial::routes!
and can produce an action for
a given HTTP Method and URL path combination using action_for
.
You never have to create a Router
, except maybe in testing.
Implementations
impl Router
[src]
pub fn new() -> Router
[src]
Create a new Router
. You shouldn't have to do this.
pub fn action_for(
&self,
req: &mut Request
) -> Option<&fn(_: Request) -> Response>
[src]
&self,
req: &mut Request
) -> Option<&fn(_: Request) -> Response>
Given a Request
, produce a match as
determined by the calls to
vial::routes!
in this application.
It will also modify the passed Request
object with any
arguments that may have matched in the URL.
pub fn insert<T: Into<Method>>(
&mut self,
method: T,
pattern: &'static str,
action: fn(_: Request) -> Response
)
[src]
&mut self,
method: T,
pattern: &'static str,
action: fn(_: Request) -> Response
)
Insert a route into the router. Routes are checked in FIFO manner when we are trying to match a URL and HTTP Method.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Router
[src]
impl Send for Router
[src]
impl Sync for Router
[src]
impl Unpin for Router
[src]
impl UnwindSafe for Router
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,