Function warp::filters::body::concat [−][src]
pub fn concat(
) -> impl Filter<Extract = (FullBody,), Error = Rejection> + Copy
Returns a Filter
that matches any request and extracts a Future
of a
concatenated body.
Warning
This does not have a default size limit, it would be wise to use one to prevent a overly large request from using too much memory.
Example
use warp::{Buf, Filter}; let route = warp::body::content_length_limit(1024 * 32) .and(warp::body::concat()) .map(|mut full_body: warp::body::FullBody| { // FullBody is a `Buf`, which could have several non-contiguous // slices of memory... let mut remaining = full_body.remaining(); while remaining != 0 { println!("slice = {:?}", full_body.bytes()); let cnt = full_body.bytes().len(); full_body.advance(cnt); remaining -= cnt; } });