pub struct Dynamic<T: CustomType>(/* private fields */);Expand description
A weak reference to a Rooted<T>.
Implementations§
source§impl<T> Dynamic<T>where
T: CustomType + Trace,
impl<T> Dynamic<T>where
T: CustomType + Trace,
sourcepub fn new<'guard>(
value: T,
guard: &impl AsRef<CollectionGuard<'guard>>,
) -> Self
pub fn new<'guard>( value: T, guard: &impl AsRef<CollectionGuard<'guard>>, ) -> Self
Moves value into the garbage collector and returns a weak reference to
it.
sourcepub fn load<'guard>(
&self,
guard: &'guard CollectionGuard<'_>,
) -> Option<&'guard T>
pub fn load<'guard>( &self, guard: &'guard CollectionGuard<'_>, ) -> Option<&'guard T>
Loads a reference to the underlying data, if it has not been collected.
sourcepub fn try_load<'guard>(
&self,
guard: &'guard CollectionGuard<'_>,
) -> Result<&'guard T, ValueFreed>
pub fn try_load<'guard>( &self, guard: &'guard CollectionGuard<'_>, ) -> Result<&'guard T, ValueFreed>
Loads a reference to the underlying data, if it has not been collected.
sourcepub fn as_rooted(&self, guard: &CollectionGuard<'_>) -> Option<Rooted<T>>
pub fn as_rooted(&self, guard: &CollectionGuard<'_>) -> Option<Rooted<T>>
Loads a rooted reference to the underlying data, if it has not been collected.
sourcepub const fn into_value(self) -> Value
pub const fn into_value(self) -> Value
Returns this dynamic as a Value.
sourcepub const fn into_any_dynamic(self) -> AnyDynamic
pub const fn into_any_dynamic(self) -> AnyDynamic
Returns this reference with its type erased.
Trait Implementations§
source§impl<T> Clone for Dynamic<T>where
T: CustomType,
impl<T> Clone for Dynamic<T>where
T: CustomType,
source§impl<T> Debug for Dynamic<T>where
T: CustomType + Trace,
impl<T> Debug for Dynamic<T>where
T: CustomType + Trace,
source§impl<T> From<Dynamic<T>> for AnyRefwhere
T: CustomType + Trace,
impl<T> From<Dynamic<T>> for AnyRefwhere
T: CustomType + Trace,
source§impl<T> PartialEq for Dynamic<T>where
T: CustomType + Trace,
impl<T> PartialEq for Dynamic<T>where
T: CustomType + Trace,
impl<T> Copy for Dynamic<T>where
T: CustomType,
Auto Trait Implementations§
impl<T> Freeze for Dynamic<T>
impl<T> RefUnwindSafe for Dynamic<T>
impl<T> Send for Dynamic<T>
impl<T> Sync for Dynamic<T>
impl<T> Unpin for Dynamic<T>
impl<T> UnwindSafe for Dynamic<T>
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
Mutably borrows from an owned value. Read more
§impl<A> Cast for A
impl<A> Cast for A
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)