Remove Dynamic::as_locked_immutable_string.

This commit is contained in:
Stephen Chung
2021-03-03 18:13:41 +08:00
parent 58df3ca141
commit 41c39a2060
4 changed files with 26 additions and 35 deletions

View File

@@ -1489,15 +1489,6 @@ impl Dynamic {
_ => Err(self.type_name()),
}
}
/// Cast the [`Dynamic`] as an [`ImmutableString`] and return it.
/// Returns the name of the actual type if the cast fails.
#[inline]
pub(crate) fn as_locked_immutable_string<'a>(
&'a self,
) -> Result<impl Deref<Target = ImmutableString> + 'a, &'static str> {
self.read_lock::<ImmutableString>()
.ok_or_else(|| self.type_name())
}
/// Convert the [`Dynamic`] into a [`String`] and return it.
/// If there are other references to the same string, a cloned copy is returned.
/// Returns the name of the actual type if the cast fails.