Skip to content
This repository was archived by the owner on Aug 15, 2021. It is now read-only.

Commit 66c5d69

Browse files
committed
Add Value::take
1 parent ff6b6b0 commit 66c5d69

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/value/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ mod ser;
55

66
use std::cmp::{Ord, Ordering, PartialOrd};
77
use std::collections::BTreeMap;
8+
use std::mem;
89

910
#[doc(inline)]
1011
pub use self::de::from_value;
@@ -321,4 +322,9 @@ impl Value {
321322
_ => None,
322323
}
323324
}
325+
326+
/// Take the [Value], leaving [Null] in place.
327+
pub fn take(&mut self) -> Value {
328+
mem::replace(self, Value::Null)
329+
}
324330
}

0 commit comments

Comments
 (0)