Function warp::filters::path::peek

source ·
pub fn peek() -> impl Filter<Extract = (Peek,), Error = Never> + Copy
Expand description

Peek at the unmatched tail of the path, without affecting the matched path.

This will return a Peek, which allows access to the rest of the path that previous filters have not already matched. This differs from tail in that peek will not set the entire path as matched.

Example

use warp::Filter;

let route = warp::path("foo")
    .and(warp::path::peek())
    .map(|peek| {
        // GET /foo/bar/baz would return "bar/baz".
        format!("The path after foo is {:?}", peek)
    });