Struct salvo_core::routing::Router [−][src]
pub struct Router { /* fields omitted */ }
Implementations
impl Router
[src]
impl Router
[src]pub fn routers_mut(&mut self) -> &mut Vec<Router>
[src]
pub fn routers_mut(&mut self) -> &mut Vec<Router>
[src]Get current router’s children mutable reference.
pub fn befores(&self) -> &Vec<Arc<dyn Handler>>
[src]
pub fn befores(&self) -> &Vec<Arc<dyn Handler>>
[src]Get current router’s before middlewares reference.
pub fn befores_mut(&mut self) -> &mut Vec<Arc<dyn Handler>>
[src]
pub fn befores_mut(&mut self) -> &mut Vec<Arc<dyn Handler>>
[src]Get current router’s before middlewares mutable reference.
pub fn afters(&self) -> &Vec<Arc<dyn Handler>>
[src]
pub fn afters(&self) -> &Vec<Arc<dyn Handler>>
[src]Get current router’s after middlewares reference.
pub fn afters_mut(&mut self) -> &mut Vec<Arc<dyn Handler>>
[src]
pub fn afters_mut(&mut self) -> &mut Vec<Arc<dyn Handler>>
[src]Get current router’s after middlewares mutable reference.
pub fn filters_mut(&mut self) -> &mut Vec<Box<dyn Filter>>
[src]
pub fn filters_mut(&mut self) -> &mut Vec<Box<dyn Filter>>
[src]Get current router’s filters mutable reference.
pub fn detect(
&self,
req: &mut Request,
path_state: &mut PathState
) -> Option<DetectMatched>
[src]
pub fn detect(
&self,
req: &mut Request,
path_state: &mut PathState
) -> Option<DetectMatched>
[src]Detect current router is matched for current request.
pub fn append(self, others: Vec<Router>) -> Self
[src]
pub fn append(self, others: Vec<Router>) -> Self
[src]Append all routers in a Vec as children of current router.
pub fn push_when<F>(self, func: F) -> Self where
F: Fn(&Router) -> Option<Router>,
[src]
F: Fn(&Router) -> Option<Router>,
Please use then function instead
pub fn before<H: Handler>(self, handler: H) -> Self
[src]
pub fn before<H: Handler>(self, handler: H) -> Self
[src]Add a handler as middleware, it will run before the handler in current router or it’s descendants handle the request.
pub fn after<H: Handler>(self, handler: H) -> Self
[src]
pub fn after<H: Handler>(self, handler: H) -> Self
[src]Add a handler as middleware, it will run after the handler in current router or it’s descendants handle the request.
pub fn filter_fn<T>(self, func: T) -> Self where
T: Fn(&mut Request, &mut PathState) -> bool + Send + Sync + 'static,
[src]
pub fn filter_fn<T>(self, func: T) -> Self where
T: Fn(&mut Request, &mut PathState) -> bool + Send + Sync + 'static,
[src]Create a new FnFilter from Fn.
pub fn then<F>(self, func: F) -> Self where
F: FnOnce(Self) -> Self,
[src]
pub fn then<F>(self, func: F) -> Self where
F: FnOnce(Self) -> Self,
[src]When you want write router chain, this function will be useful, You can write your custom logic in FnOnce.
pub fn get<H: Handler>(self, handler: H) -> Self
[src]
pub fn get<H: Handler>(self, handler: H) -> Self
[src]Create a new child router with MethodFilter to filter get method and set this child router’s handler.
pub fn post<H: Handler>(self, handler: H) -> Self
[src]
pub fn post<H: Handler>(self, handler: H) -> Self
[src]Create a new child router with MethodFilter to filter post method and set this child router’s handler.
pub fn put<H: Handler>(self, handler: H) -> Self
[src]
pub fn put<H: Handler>(self, handler: H) -> Self
[src]Create a new child router with MethodFilter to filter put method and set this child router’s handler.
pub fn delete<H: Handler>(self, handler: H) -> Self
[src]
pub fn delete<H: Handler>(self, handler: H) -> Self
[src]Create a new child router with MethodFilter to filter delete method and set this child router’s handler.
pub fn patch<H: Handler>(self, handler: H) -> Self
[src]
pub fn patch<H: Handler>(self, handler: H) -> Self
[src]Create a new child router with MethodFilter to filter patch method and set this child router’s handler.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Router
impl Send for Router
impl Sync for Router
impl Unpin for Router
impl !UnwindSafe for Router
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>
impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
[src]impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,