diff --git a/src/userdata/cell.rs b/src/userdata/cell.rs index 6df3612..b62c3ec 100644 --- a/src/userdata/cell.rs +++ b/src/userdata/cell.rs @@ -412,6 +412,15 @@ impl UserDataStorage { } } + #[allow(unused)] + #[inline(always)] + pub(crate) fn try_borrow(&self) -> Result> { + match self { + Self::Owned(data) => data.try_borrow(), + Self::Scoped(_) => Err(Error::UserDataTypeMismatch), + } + } + #[inline(always)] pub(crate) fn try_borrow_mut(&self) -> Result> { match self {