Struct WeakPtr

struct WeakPtr<T> { ... }
where
    T: WeakPtrTarget

Binding to C++ std::weak_ptr<T>.

The typical way to construct a WeakPtr from Rust is by downgrading from a SharedPtr.

Implementations

impl<T> WeakPtr<T>

fn null() -> Self

Makes a new WeakPtr wrapping a null pointer.

Matches the behavior of default-constructing a std::weak_ptr.

fn upgrade(self: &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.

impl<T> Any for WeakPtr<T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for WeakPtr<T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for WeakPtr<T>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> Clone for WeakPtr<T>

fn clone(self: &Self) -> Self

impl<T> CloneToUninit for WeakPtr<T>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> Debug for WeakPtr<T>

fn fmt(self: &Self, formatter: &mut Formatter<'_>) -> Result

impl<T> Drop for WeakPtr<T>

fn drop(self: &mut Self)

impl<T> Freeze for WeakPtr<T>

impl<T> From for WeakPtr<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> RefUnwindSafe for WeakPtr<T>

impl<T> Send for WeakPtr<T>

impl<T> Sync for WeakPtr<T>

impl<T> ToOwned for WeakPtr<T>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> Unpin for WeakPtr<T>

impl<T> UnsafeUnpin for WeakPtr<T>

impl<T> UnwindSafe for WeakPtr<T>

impl<T, U> Into for WeakPtr<T>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for WeakPtr<T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for WeakPtr<T>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>