Skip to main content

RefCounter

Trait RefCounter 

Source
pub trait RefCounter: Clone + Deref<Target = Self::Item> {
    type Item;

    // Required method
    fn new(elem: Self::Item) -> Self;
}
Expand description

Reference Counter

Stores the number of references, pointers, or handles to a resource, such as an object, a block of memory, disk space and others.

Required Associated Types§

Source

type Item

Item behind this counter.

Required Methods§

Source

fn new(elem: Self::Item) -> Self

Generic way to build a reference counter.

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.

Implementations on Foreign Types§

Source§

impl<T> RefCounter for Rc<T>

Source§

type Item = T

Source§

fn new(elem: Self::Item) -> Self

Implementors§

Source§

impl<T> RefCounter for Arc<T>

Source§

type Item = T