Use .take instead of mem::take().

This commit is contained in:
Stephen Chung
2023-04-21 10:20:19 +08:00
parent 2034ddd830
commit f49ce33a88
14 changed files with 72 additions and 57 deletions

View File

@@ -1146,6 +1146,11 @@ impl Dynamic {
)),
}
}
/// Return this [`Dynamic`], replacing it with [`Dynamic::UNIT`].
#[inline(always)]
pub fn take(&mut self) -> Self {
mem::take(self)
}
/// Convert the [`Dynamic`] value into specific type.
///
/// Casting to a [`Dynamic`] just returns as is, but if it contains a shared value,