pub struct RouterBuilder<'a, C, P> where
    C: PipelineHandleChain<P> + Copy + Send + Sync + 'static,
    P: Send + Sync + 'static, 
{ /* private fields */ }
Expand description

The top-level builder which is created by build_router and passed to the provided closure. See the build_router function and the DrawRoutes trait for usage.

Implementations

Adds a ResponseExtender to the ResponseFinalizer in the Router.

struct MyExtender;

impl ResponseExtender<Body> for MyExtender {
    fn extend(&self, state: &mut State, response: &mut Response<Body>) {
        // Extender implementation omitted.
    }
}

fn router() -> Router {
    build_simple_router(|route| {
        route.add_response_extender(StatusCode::INTERNAL_SERVER_ERROR, MyExtender);
    })
}

Trait Implementations

Creates a route which matches GET and HEAD requests to the given path. Read more

Creates a route which matches only GET requests to the given path (ignoring HEAD requests). Read more

Creates a route which matches HEAD requests to the given path. Read more

Creates a route which matches POST requests to the given path. Read more

Creates a route which matches PUT requests to the given path. Read more

Creates a route which matches PATCH requests to the given path. Read more

Creates a route which matches DELETE requests to the given path. Read more

Creates a route which matches OPTIONS requests to the given path. Read more

Creates a single route which matches any requests to the given path with one of the given methods. The path can consist of static or dynamic segments, for example: Read more

Begins defining a new scope, based on a given path prefix. Read more

Begins a new scope at the current location, with an alternate pipeline chain. Read more

Begins delegating a subpath of the tree. Read more

Begins delegating a subpath of the tree, but does not dispatch the requests via this router’s PipelineChain. Read more

Begins associating routes with a fixed path in the tree. In this way, multiple routes can be quickly associated with a single location. 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

Returns the argument unchanged.

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

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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