pub fn param2<T>() -> impl Filter<Extract = (T,), Error = Rejection> + Copywhere
T: FromStr + Send,
T::Err: Into<Cause>,
Expand description
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
. In
contrast of param
method, it reports an error cause in response.
Example
use warp::Filter;
let route = warp::path::param2()
.map(|id: u32| {
format!("You asked for /{}", id)
});