#[repr(C)]pub struct WeakPtr<T>where
T: WeakPtrTarget,{ /* private fields */ }
Expand description
Binding to C++ std::weak_ptr<T>
.
The typical way to construct a WeakPtr from Rust is by downgrading from a SharedPtr.
Implementations§
Source§impl<T> WeakPtr<T>where
T: WeakPtrTarget,
impl<T> WeakPtr<T>where
T: WeakPtrTarget,
Sourcepub fn null() -> Self
pub fn null() -> Self
Makes a new WeakPtr wrapping a null pointer.
Matches the behavior of default-constructing a std::weak_ptr.
Sourcepub fn upgrade(&self) -> SharedPtr<T>where
T: SharedPtrTarget,
pub fn upgrade(&self) -> SharedPtr<T>where
T: SharedPtrTarget,
Upgrades a non-owning reference into an owning reference if possible, otherwise to a null reference.
Matches the behavior of std::weak_ptr<T>::lock.
Trait Implementations§
Source§impl<T> Clone for WeakPtr<T>where
T: WeakPtrTarget,
impl<T> Clone for WeakPtr<T>where
T: WeakPtrTarget,
Source§impl<T> Drop for WeakPtr<T>where
T: WeakPtrTarget,
impl<T> Drop for WeakPtr<T>where
T: WeakPtrTarget,
impl<T> Send for WeakPtr<T>
impl<T> Sync for WeakPtr<T>
Auto Trait Implementations§
impl<T> Freeze for WeakPtr<T>
impl<T> RefUnwindSafe for WeakPtr<T>where
T: RefUnwindSafe,
impl<T> Unpin for WeakPtr<T>where
T: Unpin,
impl<T> UnwindSafe for WeakPtr<T>where
T: UnwindSafe,
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