1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-09-09 05:08:32 +00:00

add Payload::take method

This commit is contained in:
Nikolay Kim 2019-03-02 18:37:09 -08:00
parent 00ea195601
commit 2d0495093c

View file

@ -39,6 +39,13 @@ impl From<PayloadStream> for Payload {
}
}
impl<S> Payload<S> {
/// Takes current payload and replaces it with `None` value
fn take(&mut self) -> Payload<S> {
std::mem::replace(self, Payload::None)
}
}
impl<S> Stream for Payload<S>
where
S: Stream<Item = Bytes, Error = PayloadError>,