Struct salvo::Router[][src]

pub struct Router { /* fields omitted */ }

Implementations

Create a new Router.

Get current router’s children reference.

Get current router’s children mutable reference.

Get current router’s before middlewares reference.

Get current router’s before middlewares mutable reference.

Get current router’s after middlewares reference.

Get current router’s after middlewares mutable reference.

Get current router’s filters reference.

Get current router’s filters mutable reference.

Detect current router is matched for current request.

Push a router as child of current router.

Append all routers in a Vec as children of current router.

👎 Deprecated since 0.10.4:

Please use then function instead

Add a handler as middleware, it will run before the handler in current router or it’s descendants handle the request.

Add a handler as middleware, it will run after the handler in current router or it’s descendants handle the request.

Create a new path filter for current router.

Panics

Panics if path value is not in correct format.

Add a filter for current router.

Create a new FnFilter from Fn.

Set current router’s handler.

When you want write router chain, this function will be useful, You can write your custom logic in FnOnce.

Create a new child router with MethodFilter to filter get method and set this child router’s handler.

Create a new child router with MethodFilter to filter post method and set this child router’s handler.

Create a new child router with MethodFilter to filter put method and set this child router’s handler.

Create a new child router with MethodFilter to filter delete method and set this child router’s handler.

Create a new child router with MethodFilter to filter patch method and set this child router’s handler.

Create a new child router with MethodFilter to filter head method and set this child router’s handler.

Create a new child router with MethodFilter to filter options method and set this child router’s handler.

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.