pub trait Referencing: Sized {
// Required method
fn as_ptr(&self) -> *const c_void;
// Provided methods
fn as_mut_ptr(&self) -> *mut c_void { ... }
fn retain(&self) -> Self
where Self: Clone { ... }
fn release(&self) { ... }
fn autorelease(&self) -> Self
where Self: Clone { ... }
fn retain_count(&self) -> UInteger { ... }
}Expand description
Base trait for all Objective-C objects that support reference counting.
C++ equivalent: NS::Referencing<_Class, _Base>
Required Methods§
Provided Methods§
Sourcefn as_mut_ptr(&self) -> *mut c_void
fn as_mut_ptr(&self) -> *mut c_void
Get the raw mutable pointer to the Objective-C object.
Sourcefn retain(&self) -> Selfwhere
Self: Clone,
fn retain(&self) -> Selfwhere
Self: Clone,
Retain the object, incrementing its reference count.
C++ equivalent: _Class* retain()
Sourcefn release(&self)
fn release(&self)
Release the object, decrementing its reference count.
C++ equivalent: void release()
Sourcefn autorelease(&self) -> Selfwhere
Self: Clone,
fn autorelease(&self) -> Selfwhere
Self: Clone,
Autorelease the object.
C++ equivalent: _Class* autorelease()
Sourcefn retain_count(&self) -> UInteger
fn retain_count(&self) -> UInteger
Get the retain count of the object.
C++ equivalent: UInteger retainCount() const
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.