pub struct AnyObj { /* private fields */ }
Expand description
A type-erased wrapper for a reference, whether it is mutable or not.
Implementations§
Source§impl AnyObj
impl AnyObj
Sourcepub fn borrow_ref<T>(&self) -> Result<BorrowRef<'_, T>, AnyObjError>where
T: Any,
pub fn borrow_ref<T>(&self) -> Result<BorrowRef<'_, T>, AnyObjError>where
T: Any,
Get a reference to the interior value while checking for shared access.
This prevents other exclusive accesses from being performed while the guard returned from this function is live.
Sourcepub fn try_borrow_ref<T>(&self) -> Result<Option<BorrowRef<'_, T>>, AccessError>where
T: Any,
pub fn try_borrow_ref<T>(&self) -> Result<Option<BorrowRef<'_, T>>, AccessError>where
T: Any,
Try to borrow a reference to the interior value while checking for shared access.
Returns None
if the interior type is not T
.
This prevents other exclusive accesses from being performed while the guard returned from this function is alive.
Sourcepub fn try_borrow_mut<T>(&self) -> Result<Option<BorrowMut<'_, T>>, AccessError>where
T: Any,
pub fn try_borrow_mut<T>(&self) -> Result<Option<BorrowMut<'_, T>>, AccessError>where
T: Any,
Try to borrow a reference to the interior value while checking for exclusive access.
Returns None
if the interior type is not T
.
This prevents other exclusive accesses from being performed while the guard returned from this function is alive.
Sourcepub fn borrow_mut<T>(&self) -> Result<BorrowMut<'_, T>, AnyObjError>where
T: Any,
pub fn borrow_mut<T>(&self) -> Result<BorrowMut<'_, T>, AnyObjError>where
T: Any,
Returns some mutable reference to the boxed value if it is of type T
.
Trait Implementations§
Source§impl FromValue for AnyObj
impl FromValue for AnyObj
Source§fn from_value(value: Value) -> Result<Self, RuntimeError>
fn from_value(value: Value) -> Result<Self, RuntimeError>
Auto Trait Implementations§
impl Freeze for AnyObj
impl !RefUnwindSafe for AnyObj
impl !Send for AnyObj
impl !Sync for AnyObj
impl Unpin for AnyObj
impl !UnwindSafe for AnyObj
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)