Struct poem::route::Route[][src]

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

Routing object

Implementations

Add an Endpoint to the specified path.

You can match the full path or wildcard path, and use the Path extractor to get the path parameters.

Example

use poem::{get, handler, route, web::Path};

#[handler]
async fn a() {}

#[handler]
async fn b(Path((group, name)): Path<(String, String)>) {}

#[handler]
async fn c(Path(path): Path<String>) {}

let app = route()
    // full path
    .at("/a/b", get(a))
    // capture parameters
    .at("/b/:group/:name", get(b))
    // capture tail path
    .at("/c/*path", get(c));

Nest a Endpoint to the specified path.

Trait Implementations

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

Get the response to the request.

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.

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.