pub fn path<P>(p: P) -> Exact<Opaque<P>>
Expand description
Create an exact match path segment Filter
.
This will try to match exactly to the current request path segment.
§Note
end()
should be used to match the end of a path to avoid having filters for shorter paths like/math
unintentionally match a longer path such as/math/sum
- Path-related filters should generally come before other types of filters, such as those checking headers or body types. Including those other filters before the path checks may result in strange errors being returned because a given request does not match the parameters for a completely separate route.
§Panics
Exact path filters cannot be empty, or contain slashes.
§Example
use warp::Filter;
// Matches '/hello'
let hello = warp::path("hello")
.map(|| "Hello, World!");