Struct salvo::Router[][src]

pub struct Router { /* fields omitted */ }
Expand description

Router struct is used for route request to different handlers.

Implementations

Create a new Router.

Get current router’s children reference.

Get current router’s children mutable reference.

Get current router’s middlewares reference.

Get current router’s 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.

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

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

Create a new router and set path filter.

Panics

Panics if path value is not in correct format.

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

Performs the conversion.

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more