Skip to main content

Referencing

Trait Referencing 

Source
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§

Source

fn as_ptr(&self) -> *const c_void

Get the raw pointer to the Objective-C object.

Provided Methods§

Source

fn as_mut_ptr(&self) -> *mut c_void

Get the raw mutable pointer to the Objective-C object.

Source

fn retain(&self) -> Self
where Self: Clone,

Retain the object, incrementing its reference count.

C++ equivalent: _Class* retain()

Source

fn release(&self)

Release the object, decrementing its reference count.

C++ equivalent: void release()

Source

fn autorelease(&self) -> Self
where Self: Clone,

Autorelease the object.

C++ equivalent: _Class* autorelease()

Source

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.

Implementors§