pub fn filter_range() -> impl Filter<Extract = (Option<String>,), Error = Rejection> + CopyExpand description
This function filters and extracts the “Range”-Header
Examples found in repository?
examples/hello.rs (line 33)
24async fn main() {
25 let test_video = "/home/uwe/Videos/Ali.mkv";
26
27 let port = 9860;
28 println!("Running test server on http://localhost:{}", port);
29
30 let route_get_video =
31 warp::path("getvideo")
32 .and(warp::path::end())
33 .and(filter_range())
34 .and_then(move |range_header| get_range_with_cb(range_header, test_video, "video/mp4", |bytes| {
35 callback(bytes);
36 }));
37
38 let route_static = dir(".")
39 .map(add_headers);
40
41 let routes =
42 route_get_video
43 .or(route_static);
44
45 warp::serve(routes)
46 .run(([127, 0, 0, 1], port))
47 .await;
48}