puzz_http/body/
ext.rs

1use super::{Body, BodyStream, BoxBody, MapErr, Next};
2
3pub trait BodyExt: Body {
4    fn next(&mut self) -> Next<'_, Self>
5    where
6        Self: Unpin,
7    {
8        Next(self)
9    }
10
11    fn map_err<F, E>(self, f: F) -> MapErr<Self, F>
12    where
13        Self: Sized,
14        F: FnMut(Self::Error) -> E,
15    {
16        MapErr::new(self, f)
17    }
18
19    fn stream(self) -> BodyStream<Self>
20    where
21        Self: Sized,
22    {
23        BodyStream::new(self)
24    }
25
26    fn boxed(self) -> BoxBody
27    where
28        Self: Sized + 'static,
29        Self::Error: Into<Box<dyn std::error::Error>>,
30    {
31        BoxBody::new(self)
32    }
33}
34
35impl<B> BodyExt for B where B: Body {}