Struct slice_queue::SliceQueue[][src]

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

Methods

impl<T> SliceQueue<T>
[src]

Creates a new SliceQueue

Returns the new SliceQueue

Creates a new SliceQueue with a preallocated capacity n

Parameters:

  • n: The capacity to preallocate

Returns the new SliceQueue

Creates a new SliceQueue with a predefined limit (the default limit is usize::MAX)

Parameters:

  • limit: The limit to enforce. The limit indicates the maximum amount of elements that can be stored by self.

Returns the new SliceQueue

The amount of elements stored

Returns the amount of elements stored in self

Checks if there are no elements stored

Returns either true if self is empty or false otherwise

Returns the allocated capacity

Returns the allocated capacity of self

Reserves an additional amount of memory to push additional_element_count elements without reallocating

Parameters:

  • additional_element_count: The amount of elements that we should be able to append without reallocating

Shrinks the allocated capacity if less than it's half is used or the allocated capacity is greater than self.limit.

Shrinks the allocated capacity as much as possible

Returns the current limit

Returns the current size-limit of self

Sets a new limit (the default limit is usize::MAX)

Info: The limit is only enforced during the push*-calls. If the current length exceeds the new limit, nothing happens until a push*-call would exceed the limit.

Parameters:

  • limit: The new limit to enforce. The limit indicates the maximum amount of elements that can be stored by self.

Returns the amount of space remaining until self.limit is reached

Returns the amount of space remaining in self until self.limit is reached

Consumes the first element and returns it

Returns either Some(element) if there was an element to consume or None otherwise

Consumes the first n elements and returns them

Parameters:

  • n: The amount of elements to consume

Returns either Some(elements) if there were enough elements to consume or None otherwise

Consumes the first dst.len() and moves them into dst

Warning: This function panics if there are not enough elements stored to fill dst completely

Parameters:

  • dst: The target to move the elements into

Discards the first n elements

Warning: This function panics if there are less than n elements stored in self

Parameters:

  • n: The amount of elements to discard

Returns a reference to the first element

Returns either Some(element_reference) if there is an element to reference or None otherwise

Returns a mutable reference to the first element

Returns either Some(element_reference) if there is an element to reference or None otherwise

Returns a reference to the first n elements

Parameters:

  • n: The amount of elements to reference

Returns either Some(element_references) if there are enough elements to reference or None otherwise

Returns a mutable reference to the first n elements

Parameters:

  • n: The amount of elements to reference

Returns either Some(element_references) if there are enough elements to reference or None otherwise

Appends element at the end

Warning: This function panics if self.limit is exceeded

Parameters:

  • element: The element to append at the end

Appends n at the end

Warning: This function panics if self.limit is exceeded

Parameters:

  • n: The n elements to append at the end

Clones and appends all elements in src at the end

Warning: This function panics if self.limit is exceeded

Parameters:

  • src: A slice containing the elements to clone and append

Trait Implementations

impl<T: Default> Default for SliceQueue<T>
[src]

Returns the "default value" for a type. Read more

impl<T: Debug> Debug for SliceQueue<T>
[src]

Formats the value using the given formatter. Read more

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

Performs the conversion.

impl<T> Clone for SliceQueue<T> where
    T: Clone
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T> Index<Range<usize>> for SliceQueue<T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<T> IndexMut<Range<usize>> for SliceQueue<T>
[src]

Performs the mutable indexing (container[index]) operation.

impl<T> Index<RangeFrom<usize>> for SliceQueue<T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<T> IndexMut<RangeFrom<usize>> for SliceQueue<T>
[src]

Performs the mutable indexing (container[index]) operation.

impl<T> Index<RangeTo<usize>> for SliceQueue<T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<T> IndexMut<RangeTo<usize>> for SliceQueue<T>
[src]

Performs the mutable indexing (container[index]) operation.

impl<T> Index<RangeInclusive<usize>> for SliceQueue<T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<T> IndexMut<RangeInclusive<usize>> for SliceQueue<T>
[src]

Performs the mutable indexing (container[index]) operation.

impl<T> Index<RangeToInclusive<usize>> for SliceQueue<T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<T> IndexMut<RangeToInclusive<usize>> for SliceQueue<T>
[src]

Performs the mutable indexing (container[index]) operation.

impl<T> Index<usize> for SliceQueue<T>
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl<T> IndexMut<usize> for SliceQueue<T>
[src]

Performs the mutable indexing (container[index]) operation.

impl<T> Deref for SliceQueue<T>
[src]

The resulting type after dereferencing.

Dereferences the value.

impl<T> DerefMut for SliceQueue<T>
[src]

Mutably dereferences the value.

Auto Trait Implementations

impl<T> Send for SliceQueue<T> where
    T: Send

impl<T> Sync for SliceQueue<T> where
    T: Sync