Skip to content

Queue

I am simple Queue structure, implemented as a linked list. Elements are always 64-bit values with pass by value semantics. Queue__new_owned can help if the elements are pointers to owned objects.

Queue

pub struct Queue

Type of Queues.

Queue__new

pub fn Queue__new()

I create a new empty queue.

Queue__new_owned

pub fn Queue__new_owned(void* drop_el)

I create a new empty queue, with a function pointer for dropping elements.

Queue_drop

pub fn Queue_drop(Queue* self)

I drop the queue, along with its elements (if they are owned).

Queue_peek

pub fn Queue_peek(Queue* self)

I return the next element on the queue, without removing it, panicking if the queue is empty.

Queue_push

pub fn Queue_push(Queue* self, void* el)

I push the passed element onto the queue.

Queue_remove

pub fn Queue_remove(Queue* self)

I remove and return the first element on the queue, panicking if the queue is empty.

Queue_size

pub fn Queue_size(Queue* self)

I return the number of elements currently on the queue.