[][src]Struct coco::epoch::Garbage

pub struct Garbage { /* fields omitted */ }

A garbage queue.

This is where a concurrent data structure can store removed objects for deferred destruction.

Stored garbage objects are first kept in the garbage buffer. When the buffer becomes full, it's objects are flushed into the garbage queue. Flushing can be manually triggered by calling flush.

Some garbage in the queue can be manually collected by calling collect.

Methods

impl Garbage[src]

pub fn new() -> Self[src]

Returns a new, empty garbage queue.

pub unsafe fn defer_free<T>(&self, object: *mut T, count: usize, pin: &Pin)[src]

Adds an object that will later be freed.

The specified object is an array allocated at address object and consists of count elements of type T.

This method inserts the object into the garbage buffer. When the buffers becomes full, it's objects are flushed into the garbage queue.

pub unsafe fn defer_drop<T>(&self, object: *mut T, count: usize, pin: &Pin)[src]

Adds an object that will later be dropped and freed.

The specified object is an array allocated at address object and consists of count elements of type T.

This method inserts the object into the garbage buffer. When the buffers becomes full, it's objects are flushed into the garbage queue.

Note: The object must be Send + 'self.

pub unsafe fn defer_destroy<T>(
    &self,
    destroy: unsafe fn(_: *mut T, _: usize),
    object: *mut T,
    count: usize,
    pin: &Pin
)
[src]

Adds an object that will later be destroyed using destroy.

The specified object is an array allocated at address object and consists of count elements of type T.

This method inserts the object into the garbage buffer. When the buffers becomes full, it's objects are flushed into the garbage queue.

Note: The object must be Send + 'self.

pub fn flush(&self, pin: &Pin)[src]

Flushes the buffered garbage.

It is wise to flush the garbage just after passing a very large object to one of the defer_* methods, so that it isn't sitting in the buffer for a long time.

pub fn collect(&self, pin: &Pin)[src]

Collects some garbage from the queue and destroys it.

Generally speaking, it's not necessary to call this method because garbage production already triggers garbage destruction. However, if there are long periods without garbage production, it might be a good idea to call this method from time to time.

This method collects several buffers worth of garbage objects.

Trait Implementations

impl Send for Garbage[src]

impl Sync for Garbage[src]

impl Drop for Garbage[src]

impl Debug for Garbage[src]

Auto Trait Implementations

impl Unpin for Garbage

impl !UnwindSafe for Garbage

impl !RefUnwindSafe for Garbage

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]