From 2d0495093c29b63daeed0a88aba3c7856ccb5733 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Sat, 2 Mar 2019 18:37:09 -0800 Subject: [PATCH] add Payload::take method --- src/payload.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/payload.rs b/src/payload.rs index bc40fe807..8f96bab95 100644 --- a/src/payload.rs +++ b/src/payload.rs @@ -39,6 +39,13 @@ impl From for Payload { } } +impl Payload { + /// Takes current payload and replaces it with `None` value + fn take(&mut self) -> Payload { + std::mem::replace(self, Payload::None) + } +} + impl Stream for Payload where S: Stream,