std1.0.0-beta-7 SafeC docs

std :: collections::queue

Struct std::Queue

#include <std/collections/queue.h> source

generic<T> struct Queue {
    ?&heap T data;
    unsigned long head;
    unsigned long len;
    unsigned long cap;
}

Fields

§?&heap T datasource
§unsigned long headsource

index of the front element

§unsigned long lensource

element count

§unsigned long capsource

0 or a power of two

Methods

§static struct Queue<T> new()source · definition

empty, no allocation

§static struct Queue<T> with_cap(unsigned long cap)source · definition

room for cap elements

§int enqueue(T value)source · definition

0 on OOM

§?T dequeue()source · definition

null if empty

§?&T front() constsource · definition

null if empty

§?&T back() constsource · definition

null if empty

§unsigned long length() constsource · definition
§int is_empty() constsource · definition
§void clear()source · definition

drop every element, keep the buffer

§int reserve(unsigned long n)source · definition

Re-lays the ring out linearly (front at index 0) in a buffer of max(8, n) slots rounded up to a power of two.

§void drop()source · definition

drops the elements, frees the buffer (Drop)

§void free() consumesource · definition

= drop()