pub struct Weak<T: ?Sized> { /* private fields */ }
Expand description
A weak pointer to an Objective-C reference counted object.
The object is allowed to be deallocated while the weak pointer is alive, though the backing allocation for the object can only be released once all weak pointers are gone.
Useful for breaking reference cycles and safely checking whether an object has been deallocated.
§Comparison to std
types
This is the Objective-C equivalent of sync::Weak
from the standard
library, and hence is only usable on types where Retained<T>
acts like
sync::Arc
, a.k.a. on non-mutable types.
Implementations§
Source§impl<T: Message> Weak<T>
impl<T: Message> Weak<T>
Trait Implementations§
Source§impl<T: Message> Default for Weak<T>
impl<T: Message> Default for Weak<T>
Source§fn default() -> Self
fn default() -> Self
Constructs a new weak pointer that doesn’t reference any object.
Calling Self::load
on the return value always gives None
.
impl<T: ?Sized + RefUnwindSafe> RefUnwindSafe for Weak<T>
impl<T: ?Sized + Sync + Send> Send for Weak<T>
impl<T: ?Sized + Sync + Send> Sync for Weak<T>
impl<T: ?Sized> Unpin for Weak<T>
impl<T: ?Sized + RefUnwindSafe> UnwindSafe for Weak<T>
Auto Trait Implementations§
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