Struct fixed_circular_buffer::CircularBuffer [] [src]

pub struct CircularBuffer<T> { /* fields omitted */ }

Fixed size circular/cyclic/ring buffer

A FIFO (first in, first out) queue. It cannot represent an empty buffer.

When constructed, the internal list must not be empty, and cannot contain invalid (e.g. uninitialized) elements.

Methods

impl<T> CircularBuffer<T>
[src]

Returns the number of elements (before starting to loop around).

Enqueues (push at beginning) the given element at the beginning of the buffer Dequeues (pop at end) the last element and returns it This keeps the the buffer length

Sets the offset for the first element, relative to the currently first element When index is out of range, it loops around

Returns a reference to the element at the given index When index is out of range, it loops around

Returns a mutable reference to the element at the given index When index is out of range, it loops around

Swaps the two elements at the given indices a and b. When a or b are out of range, they loop around

Swaps the element at the given index with the specifiied new one. When a or b are out of range, they loop around

Returns an iterator over the buffer looping around at the end. This creates a never ending iterator

Returns an iterator over the buffer without looping around.

Constructs the structure from its raw components

Unsafety

This function is unsafe as there is no guarantee that first < list.len(), nor whether list is non-empty.

Deconstructs the structure into its raw components

Trait Implementations

impl<T: Clone> Clone for CircularBuffer<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Eq> Eq for CircularBuffer<T>
[src]

impl<T: PartialEq> PartialEq for CircularBuffer<T>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<T: Hash> Hash for CircularBuffer<T>
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

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

Performs the conversion.

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

Performs the conversion.

impl<T> FromIterator<T> for CircularBuffer<T>
[src]

Creates a value from an iterator. Read more