#[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.