Struct slice_queue::SliceQueue [−][src]
pub struct SliceQueue<T> { /* fields omitted */ }
Methods
impl<T> SliceQueue<T>
[src]
impl<T> SliceQueue<T>
pub fn new() -> Self
[src]
pub fn new() -> Self
Creates a new SliceQueue
Returns the new SliceQueue
pub fn with_capacity(n: usize) -> Self
[src]
pub fn with_capacity(n: usize) -> Self
Creates a new SliceQueue
with a preallocated capacity n
Parameters:
n
: The capacity to preallocate
Returns the new SliceQueue
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
The amount of elements stored
Returns the amount of elements stored in self
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Checks if there are no elements stored
Returns either true
if self
is empty or false
otherwise
pub fn capacity(&self) -> usize
[src]
pub fn capacity(&self) -> usize
Returns the allocated capacity
Returns the allocated capacity of self
pub fn reserve(&mut self, additional_element_count: usize)
[src]
pub fn reserve(&mut self, additional_element_count: usize)
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
pub fn shrink_opportunistic(&mut self)
[src]
pub fn shrink_opportunistic(&mut self)
Shrinks the allocated capacity if less than it's half is used. This basically mirrors Vec
's
allocation strategy.
pub fn shrink_to_fit(&mut self)
[src]
pub fn shrink_to_fit(&mut self)
Shrinks the allocated capacity as much as possible
pub fn pop(&mut self) -> Option<T>
[src]
pub fn pop(&mut self) -> Option<T>
Consumes the first element and returns it
Returns either Some(element)
if there was an element to consume or None
otherwise
pub fn pop_n(&mut self, n: usize) -> Option<Vec<T>>
[src]
pub fn pop_n(&mut self, n: usize) -> Option<Vec<T>>
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
pub fn pop_into(&mut self, dst: &mut [T])
[src]
pub fn pop_into(&mut self, dst: &mut [T])
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
pub fn discard_n(&mut self, n: usize)
[src]
pub fn discard_n(&mut self, n: usize)
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
pub fn peek(&self) -> Option<&T>
[src]
pub fn peek(&self) -> Option<&T>
Returns a reference to the first element
Returns either Some(element_reference)
if there is an element to reference or None
otherwise
pub fn peek_mut(&mut self) -> Option<&mut T>
[src]
pub fn peek_mut(&mut self) -> Option<&mut T>
Returns a mutable reference to the first element
Returns either Some(element_reference)
if there is an element to reference or None
otherwise
pub fn peek_n(&self, n: usize) -> Option<&[T]>
[src]
pub fn peek_n(&self, n: usize) -> Option<&[T]>
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
pub fn peek_n_mut(&mut self, n: usize) -> Option<&mut [T]>
[src]
pub fn peek_n_mut(&mut self, n: usize) -> Option<&mut [T]>
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
pub fn push(&mut self, element: T)
[src]
pub fn push(&mut self, element: T)
Appends element
at the end
Parameters:
element
: The element to append at the end
pub fn push_n(&mut self, n: Vec<T>)
[src]
pub fn push_n(&mut self, n: Vec<T>)
Appends n
at the end
Parameters:
n
: The n elements to append at the end
pub fn push_from(&mut self, src: &[T]) where
T: Clone,
[src]
pub fn push_from(&mut self, src: &[T]) where
T: Clone,
Clones and appends all elements in src
at the end
Parameters:
src
: A slice containing the elements to clone and append
Trait Implementations
impl<T: Default> Default for SliceQueue<T>
[src]
impl<T: Default> Default for SliceQueue<T>
fn default() -> SliceQueue<T>
[src]
fn default() -> SliceQueue<T>
Returns the "default value" for a type. Read more
impl<T: Debug> Debug for SliceQueue<T>
[src]
impl<T: Debug> Debug for SliceQueue<T>
fn fmt(&self, f: &mut Formatter) -> FmtResult
[src]
fn fmt(&self, f: &mut Formatter) -> FmtResult
Formats the value using the given formatter. Read more
impl<T> From<Vec<T>> for SliceQueue<T>
[src]
impl<T> From<Vec<T>> for SliceQueue<T>
impl<T> Clone for SliceQueue<T> where
T: Clone,
[src]
impl<T> Clone for SliceQueue<T> where
T: Clone,
fn clone(&self) -> Self
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T> Index<Range<usize>> for SliceQueue<T>
[src]
impl<T> Index<Range<usize>> for SliceQueue<T>
type Output = [T]
The returned type after indexing.
fn index(&self, bounds: Range<usize>) -> &[T]
[src]
fn index(&self, bounds: Range<usize>) -> &[T]
Performs the indexing (container[index]
) operation.
impl<T> IndexMut<Range<usize>> for SliceQueue<T>
[src]
impl<T> IndexMut<Range<usize>> for SliceQueue<T>
fn index_mut(&mut self, bounds: Range<usize>) -> &mut [T]
[src]
fn index_mut(&mut self, bounds: Range<usize>) -> &mut [T]
Performs the mutable indexing (container[index]
) operation.
impl<T> Index<RangeFrom<usize>> for SliceQueue<T>
[src]
impl<T> Index<RangeFrom<usize>> for SliceQueue<T>
type Output = [T]
The returned type after indexing.
fn index(&self, bounds: RangeFrom<usize>) -> &[T]
[src]
fn index(&self, bounds: RangeFrom<usize>) -> &[T]
Performs the indexing (container[index]
) operation.
impl<T> IndexMut<RangeFrom<usize>> for SliceQueue<T>
[src]
impl<T> IndexMut<RangeFrom<usize>> for SliceQueue<T>
fn index_mut(&mut self, bounds: RangeFrom<usize>) -> &mut [T]
[src]
fn index_mut(&mut self, bounds: RangeFrom<usize>) -> &mut [T]
Performs the mutable indexing (container[index]
) operation.
impl<T> Index<RangeTo<usize>> for SliceQueue<T>
[src]
impl<T> Index<RangeTo<usize>> for SliceQueue<T>
type Output = [T]
The returned type after indexing.
fn index(&self, bounds: RangeTo<usize>) -> &[T]
[src]
fn index(&self, bounds: RangeTo<usize>) -> &[T]
Performs the indexing (container[index]
) operation.
impl<T> IndexMut<RangeTo<usize>> for SliceQueue<T>
[src]
impl<T> IndexMut<RangeTo<usize>> for SliceQueue<T>
fn index_mut(&mut self, bounds: RangeTo<usize>) -> &mut [T]
[src]
fn index_mut(&mut self, bounds: RangeTo<usize>) -> &mut [T]
Performs the mutable indexing (container[index]
) operation.
impl<T> Index<RangeInclusive<usize>> for SliceQueue<T>
[src]
impl<T> Index<RangeInclusive<usize>> for SliceQueue<T>
type Output = [T]
The returned type after indexing.
fn index(&self, bounds: RangeInclusive<usize>) -> &[T]
[src]
fn index(&self, bounds: RangeInclusive<usize>) -> &[T]
Performs the indexing (container[index]
) operation.
impl<T> IndexMut<RangeInclusive<usize>> for SliceQueue<T>
[src]
impl<T> IndexMut<RangeInclusive<usize>> for SliceQueue<T>
fn index_mut(&mut self, bounds: RangeInclusive<usize>) -> &mut [T]
[src]
fn index_mut(&mut self, bounds: RangeInclusive<usize>) -> &mut [T]
Performs the mutable indexing (container[index]
) operation.
impl<T> Index<RangeToInclusive<usize>> for SliceQueue<T>
[src]
impl<T> Index<RangeToInclusive<usize>> for SliceQueue<T>
type Output = [T]
The returned type after indexing.
fn index(&self, bounds: RangeToInclusive<usize>) -> &[T]
[src]
fn index(&self, bounds: RangeToInclusive<usize>) -> &[T]
Performs the indexing (container[index]
) operation.
impl<T> IndexMut<RangeToInclusive<usize>> for SliceQueue<T>
[src]
impl<T> IndexMut<RangeToInclusive<usize>> for SliceQueue<T>
fn index_mut(&mut self, bounds: RangeToInclusive<usize>) -> &mut [T]
[src]
fn index_mut(&mut self, bounds: RangeToInclusive<usize>) -> &mut [T]
Performs the mutable indexing (container[index]
) operation.
impl<T> Index<usize> for SliceQueue<T>
[src]
impl<T> Index<usize> for SliceQueue<T>
type Output = T
The returned type after indexing.
fn index(&self, i: usize) -> &T
[src]
fn index(&self, i: usize) -> &T
Performs the indexing (container[index]
) operation.
impl<T> IndexMut<usize> for SliceQueue<T>
[src]
impl<T> IndexMut<usize> for SliceQueue<T>
fn index_mut(&mut self, i: usize) -> &mut T
[src]
fn index_mut(&mut self, i: usize) -> &mut T
Performs the mutable indexing (container[index]
) operation.
impl<T> Deref for SliceQueue<T>
[src]
impl<T> Deref for SliceQueue<T>
type Target = <Vec<T> as Deref>::Target
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
fn deref(&self) -> &Self::Target
Dereferences the value.
impl<T> DerefMut for SliceQueue<T>
[src]
impl<T> DerefMut for SliceQueue<T>
Auto Trait Implementations
impl<T> Send for SliceQueue<T> where
T: Send,
impl<T> Send for SliceQueue<T> where
T: Send,
impl<T> Sync for SliceQueue<T> where
T: Sync,
impl<T> Sync for SliceQueue<T> where
T: Sync,