[][src]Function warp::filters::path::param

pub fn param<T: FromStr + Send + 'static>(
) -> impl Filter<Extract = (T,), Error = Rejection> + Copy

Extract a parameter from a path segment.

This will try to parse a value from the current request path segment, and if successful, the value is returned as the Filter's "extracted" value.

If the value could not be parsed, rejects with a 404 Not Found.

Example

use warp::Filter;

let route = warp::path::param()
    .map(|id: u32| {
        format!("You asked for /{}", id)
    });