mmtk::plan::tracing

Type Alias VectorObjectQueue

source
pub type VectorObjectQueue = VectorQueue<ObjectReference>;
Expand description

A vector queue for object references.

Aliased Type§

struct VectorObjectQueue {
    buffer: Vec<ObjectReference>,
}

Fields§

§buffer: Vec<ObjectReference>

Enqueued nodes.

Implementations

source§

impl<T> VectorQueue<T>

source

const CAPACITY: usize = 4_096usize

Reserve a capacity of this on first enqueue to avoid frequent resizing.

source

pub fn new() -> Self

Create an empty VectorObjectQueue.

source

pub fn is_empty(&self) -> bool

Return true if the queue is empty.

source

pub fn take(&mut self) -> Vec<T>

Return the contents of the underlying vector. It will empty the queue.

source

pub fn into_vec(self) -> Vec<T>

Consume this VectorObjectQueue and return its underlying vector.

source

pub fn is_full(&self) -> bool

Check if the buffer size reaches CAPACITY.

source

pub fn push(&mut self, v: T)

Push an element to the queue. If the queue is empty, it will reserve space to hold the number of elements defined by the capacity. The user of this method needs to make sure the queue length does not exceed the capacity to avoid allocating more space (this method will not check the length against the capacity).

Trait Implementations

source§

impl<T> Default for VectorQueue<T>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl ObjectQueue for VectorQueue<ObjectReference>

source§

fn enqueue(&mut self, v: ObjectReference)

Enqueue an object into the queue.