pub struct WeakRef<T: ObjectType> { /* private fields */ }Expand description
A weak reference to an object of class T or a class derived from it.
Implementations§
Source§impl<T: ObjectType> WeakRef<T>
impl<T: ObjectType> WeakRef<T>
Sourcepub fn upgrade(&self) -> Option<Ref<T>>
pub fn upgrade(&self) -> Option<Ref<T>>
Returns a strong reference if the object is still alive.
Sourcepub fn upcast<U: ObjectType>(self) -> WeakRef<U>where
T: Upcast<U>,
pub fn upcast<U: ObjectType>(self) -> WeakRef<U>where
T: Upcast<U>,
Converts the handle to a handle of a base class.
Sourcepub fn points_to<U: ObjectType>(&self, object: &Ref<U>) -> bool
pub fn points_to<U: ObjectType>(&self, object: &Ref<U>) -> bool
Whether the weak reference points at object.
Sourcepub fn ptr_eq<U: ObjectType>(&self, other: &WeakRef<U>) -> bool
pub fn ptr_eq<U: ObjectType>(&self, other: &WeakRef<U>) -> bool
Whether two weak references point at the same object, alive or not.
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for WeakRef<T>
impl<T> !Send for WeakRef<T>
impl<T> !Sync for WeakRef<T>
impl<T> !UnwindSafe for WeakRef<T>
impl<T> Freeze for WeakRef<T>where
PhantomData<T>: Freeze,
impl<T> Unpin for WeakRef<T>where
PhantomData<T>: Unpin,
impl<T> UnsafeUnpin for WeakRef<T>where
PhantomData<T>: UnsafeUnpin,
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more