[][src]Trait refptr::refcnt::Refcount

pub unsafe trait Refcount: Sized {
    type Metadata;
    unsafe fn new() -> Self;
unsafe fn inc_strong<T: ?Sized>(ptr: *const Inner<T>)
    where
        T: Refcounted<Rc = Self>
;
unsafe fn dec_strong<T: ?Sized>(ptr: *const Inner<T>)
    where
        T: Refcounted<Rc = Self>
;
unsafe fn strong_count<T: ?Sized>(ptr: *const Inner<T>) -> usize
    where
        T: Refcounted<Rc = Self>
; }

A reference count

Associated Types

type Metadata

Metadata type which can be obtained from the underlying Refcounted object.

Loading content...

Required methods

unsafe fn new() -> Self

Construct a new instance of the refcount, initialized to a default value.

unsafe fn inc_strong<T: ?Sized>(ptr: *const Inner<T>) where
    T: Refcounted<Rc = Self>, 

Increment the strong reference count for this object.

Prefer managing the lifecycle of Refcounted objects with RefPtr over manually calling these methods.

This must only be called while the strong reference count is at least 1. If only weak references only exist for this object, the upgrade method must be used instead.

unsafe fn dec_strong<T: ?Sized>(ptr: *const Inner<T>) where
    T: Refcounted<Rc = Self>, 

Decrement the strong reference count for this object.

Prefer managing the lifecycle of Refcounted objects with RefPtr over manually calling these methods.

unsafe fn strong_count<T: ?Sized>(ptr: *const Inner<T>) -> usize where
    T: Refcounted<Rc = Self>, 

Gets the number of strong references to this allocation.

Loading content...

Implementors

impl Refcount for Atomic[src]

type Metadata = ()

impl Refcount for AtomicFinalize[src]

type Metadata = unsafe fn(_: *const u8)

impl Refcount for AtomicWeak[src]

type Metadata = ()

impl Refcount for AtomicWeakFinalize[src]

type Metadata = unsafe fn(_: *const u8)

impl Refcount for Local[src]

type Metadata = ()

impl Refcount for LocalFinalize[src]

type Metadata = unsafe fn(_: *const u8)

impl Refcount for LocalWeak[src]

type Metadata = ()

impl Refcount for LocalWeakFinalize[src]

type Metadata = unsafe fn(_: *const u8)

Loading content...