[][src]Trait refptr::refcnt::WeakRefcount

pub unsafe trait WeakRefcount: Refcount {
    unsafe fn inc_weak<T: ?Sized>(ptr: *const Inner<T>)
    where
        T: Refcounted<Rc = Self>
;
unsafe fn dec_weak<T: ?Sized>(ptr: *const Inner<T>)
    where
        T: Refcounted<Rc = Self>
;
unsafe fn upgrade<T: ?Sized>(ptr: *const Inner<T>) -> bool
    where
        T: Refcounted<Rc = Self>
;
unsafe fn weak_count<T: ?Sized>(ptr: *const Inner<T>) -> usize
    where
        T: Refcounted<Rc = Self>
; }

A reference count supporting weak references

Required methods

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

Called to increment the weak reference count of an object.

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

Called to decrement the weak reference count of an object.

This method may free the data stored in ptr.

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

Called to attempt to obtain a new strong reference to an object.

This method will return true if the strong reference count was successfully incremented, and false otherwise.

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

Try to get the number of weak references to this allocation.

If there are no remaining strong references, this will return 0.

Loading content...

Implementors

impl WeakRefcount for AtomicWeak[src]

impl WeakRefcount for AtomicWeakFinalize[src]

impl WeakRefcount for LocalWeak[src]

impl WeakRefcount for LocalWeakFinalize[src]

Loading content...