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() -> WeakPtr<T>
pub fn null() -> WeakPtr<T>
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>where
PhantomData<T>: Freeze,
impl<T> RefUnwindSafe for WeakPtr<T>where
PhantomData<T>: RefUnwindSafe,
impl<T> Unpin for WeakPtr<T>where
PhantomData<T>: Unpin,
impl<T> UnsafeUnpin for WeakPtr<T>where
PhantomData<T>: UnsafeUnpin,
impl<T> UnwindSafe for WeakPtr<T>where
PhantomData<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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more