Fix tests.

This commit is contained in:
Stephen Chung
2022-10-27 22:08:47 +08:00
parent 4100645512
commit 25fde7dbed
5 changed files with 21 additions and 6 deletions

View File

@@ -239,6 +239,17 @@ impl<'a> Target<'a> {
_ => None,
}
}
/// Convert a shared or reference [`Target`] into a target with an owned value.
#[inline(always)]
#[must_use]
pub fn into_owned(self) -> Self {
match self {
Self::RefMut(r) => Self::TempValue(r.clone()),
#[cfg(not(feature = "no_closure"))]
Self::SharedValue { value, .. } => Self::TempValue(value),
_ => self,
}
}
/// Get the source [`Dynamic`] of the [`Target`].
#[allow(dead_code)]
#[inline]