RefCounted

Trait RefCounted 

Source
pub trait RefCounted: Class<PxRefCounted> + Sized {
    // Provided methods
    fn release(&mut self) { ... }
    fn get_reference_count(&self) -> u32 { ... }
    fn acquire_reference(&mut self) { ... }
}

Provided Methods§

Source

fn release(&mut self)

Decrements the reference count of the object and releases it if the new reference count is zero.

Source

fn get_reference_count(&self) -> u32

Returns the reference count of the object.

At creation, the reference count of the object is 1. Every other object referencing this object increments the count by 1. When the reference count reaches 0, and only then, the object gets destroyed automatically.

Source

fn acquire_reference(&mut self)

Acquires a counted reference to this object.

This method increases the reference count of the object by 1. Decrement the reference count by calling Self::release

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§

Source§

impl<T> RefCounted for T
where T: Class<PxRefCounted> + Sized,