Type Alias UpgradeIntoFn

Source
pub type UpgradeIntoFn = for<'ptr> unsafe fn(_: PtrMut<'ptr>, _: PtrUninit<'ptr>) -> Option<PtrMut<'ptr>>;
Expand description

Tries to upgrade the weak pointer to a strong one.

§Safety

weak must be a valid weak smart pointer (like std::sync::Weak or std::rc::Weak). strong must be allocated, and of the right layout for the corresponding smart pointer. strong must not have been initialized yet.

weak is not moved out of — Weak::upgrade(&self) takes self by reference. If this fails, strong is not initialized.

strong.assume_init() is returned as part of the Option if the upgrade succeeds. None is returned if this is not a type of smart pointer that supports upgrades.