1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-28 01:32:57 +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>
where
S: Stream<Item = Bytes, Error = PayloadError>,