1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-24 08:22:59 +01: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> impl<S> Stream for Payload<S>
where where
S: Stream<Item = Bytes, Error = PayloadError>, S: Stream<Item = Bytes, Error = PayloadError>,