Skip to main content

retain_ptr

Function retain_ptr 

Source
pub unsafe fn retain_ptr<T>(ptr: *mut c_void) -> Option<SharedPtr<T>>
Expand description

Create a SharedPtr by retaining an existing raw pointer.

Increases the reference count of the passed-in object.

C++ equivalent: NS::SharedPtr<_Class> RetainPtr(_Class* pObject)

ยงSafety

The pointer must be a valid Objective-C object with a retain count >= 1.