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>
impl<T> VectorQueue<T>
sourceconst CAPACITY: usize = 4_096usize
const CAPACITY: usize = 4_096usize
Reserve a capacity of this on first enqueue to avoid frequent resizing.
sourcepub fn take(&mut self) -> Vec<T>
pub fn take(&mut self) -> Vec<T>
Return the contents of the underlying vector. It will empty the queue.
sourcepub fn into_vec(self) -> Vec<T>
pub fn into_vec(self) -> Vec<T>
Consume this VectorObjectQueue
and return its underlying vector.
sourcepub fn push(&mut self, v: T)
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>
impl<T> Default for VectorQueue<T>
source§impl ObjectQueue for VectorQueue<ObjectReference>
impl ObjectQueue for VectorQueue<ObjectReference>
source§fn enqueue(&mut self, v: ObjectReference)
fn enqueue(&mut self, v: ObjectReference)
Enqueue an object into the queue.