Skip to main content

RefCnt

Trait RefCnt 

Source
pub unsafe trait RefCnt {
    // Required methods
    fn increase_ref(&self);
    fn decrease_ref(&self) -> usize;
}
Expand description

Provides methods to increase/decrease a strong reference to reference-counted mmemory block.

§Safety

The number of strong references store on the memory can only modified by Self::increase_ref() and Self::decrease_ref(). The initial value must be zero.

Required Methods§

Source

fn increase_ref(&self)

Increments the strong reference count on the memory.

§Panics

If reference count already at usize::MAX.

Source

fn decrease_ref(&self) -> usize

Decrements the strong reference count on the memory and returns number of references before the decreasement.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§