devela::all

Struct Destaque

Source
pub struct Destaque<T, const CAP: usize, IDX, S: Storage = Bare> { /* private fields */ }
Expand description

A static double-ended queue and stack backed by an Array.

It is generic in respect to its elements (T), capacity (CAP), index size (IDX) and storage (S).

The index size will upper-bound the capacity to the maximum for that type, e.g. u8::MAX for DestaqueU8.

The index size determines the maximum possible number of elements in the destaque, thereby upper-bounding the capacity to the maximum value representable by the index type. For example, u8::MAX for DestaqueU8.

The total size in bytes of the stack may be influenced by the chosen index size, depending on the size and alignment of the elements. This difference could only be significant for small capacities, as only one index is stored.

See also the related aliases that specify IDX: DestaqueU8, DestaqueU16, DestaqueU32, DestaqueUsize, and the related traits: DataQueue, DataDeque, DataStack, DataDesta.

§Methods

It implements methods that operate from both the front and the back. Rememeber that a single-ended stack operates only from the back, while a single-ended queue pushes to the back and pops from the front.

Implementations§

Source§

impl<T: Clone, const CAP: usize> Destaque<T, CAP, u8, Bare>

§Methods for DestaqueU8



This impl block contains no items.
Source§

impl<T: Clone, const CAP: usize> Destaque<T, CAP, u8, Bare>

Source

pub fn new(element: T) -> Result<Self, MismatchedCapacity>

Returns an empty destaque, allocated in the stack, cloning element to fill the remaining free data.

§Errors

Returns MismatchedCapacity if CAP > u8::MAX or if CAP > isize::MAX / size_of::<T>().

§Examples
let q = DestaqueU8::<_, 16>::new(0).unwrap();
Source§

impl<T: Copy, const CAP: usize> Destaque<T, CAP, u8, Bare>

Source

pub const fn new_copied(element: T) -> Result<Self, MismatchedCapacity>

Returns an empty destaque, allocated in the stack, copying element to fill the remaining free data, in compile-time.

§Errors

Returns MismatchedCapacity if CAP > u8::MAX or if CAP > isize::MAX / size_of::<T>().

§Examples
const S: DestaqueU8<i32, 16> = unwrap![ok DestaqueU8::new_copied(0)];
Source§

impl<T: Clone, const CAP: usize> Destaque<T, CAP, u8, Boxed>

Source

pub fn new(element: T) -> Self

Available on crate feature alloc only.

Returns an empty destaque, allocated in the heap, cloning element to fill the remaining free data.

§Examples
let q = DestaqueU8::<_, 3, Boxed>::new(0);
Source§

impl<T, const CAP: usize> Destaque<T, CAP, u8, Bare>

Source

pub const fn from_array_copy(arr: [T; CAP]) -> Destaque<T, CAP, u8, Bare>

Converts an array into a full destaque.

§Examples
let q = DestaqueU8::<_, 3>::from_array([1, 2, 3]);
Source§

impl<T, const CAP: usize, S: Storage> Destaque<T, CAP, u8, S>

Source

pub fn from_array(arr: [T; CAP]) -> Destaque<T, CAP, u8, S>

Converts an array into a full destaque.

§Examples
let q = DestaqueU8::<_, 3>::from_array([1, 2, 3]);
Source

pub const fn len(&self) -> u8

Returns the number of destaqued elements.

Source

pub const fn is_empty(&self) -> bool

Returns true if the destaque is empty.

§Examples
let q = DestaqueU8::<i32, 8>::default();
assert![q.is_empty()];
Source

pub const fn is_full(&self) -> bool

Returns true if the destaque is full.

§Examples
let q = DestaqueU8::<_, 3>::from([1, 2, 3]);
assert![q.is_full()];
Source

pub const fn capacity(&self) -> u8

Returns the destaque’s total capacity.

§Examples
let q = DestaqueU8::<i32, 3>::default();
assert_eq![3, q.capacity()];
Source

pub const fn remaining_capacity(&self) -> u8

Returns the destaque’s remaining capacity.

§Examples
let mut q = DestaqueU8::<i32, 3>::default();
assert_eq![3, q.remaining_capacity()];
q.push_back(1)?;
assert_eq![2, q.remaining_capacity()];
Source

pub fn as_slices(&self) -> (&[T], &[T])

Returns the destaque as pair of shared slices, which contain, in order, the contents of the destaque.

§Examples
let q = DestaqueU8::<_, 3>::from([1, 2, 3]);
assert_eq![q.as_slices(), (&[1, 2, 3][..], &[][..])];
Source

pub const fn is_contiguous(&self) -> bool

Returns true if the destaque is contiguous.

§Examples
let mut q = DestaqueU8::<_, 3>::from([1, 2, 3]);
assert_eq![q.as_slices(), (&[1, 2, 3][..], &[][..])];
assert![q.is_contiguous()];
q.pop_back()?;
q.push_front(4)?;
assert![!q.is_contiguous()];
assert_eq![q.as_slices(), (&[4][..], &[1, 2][..])];
Source

pub fn push_front(&mut self, element: T) -> Result<(), NotEnoughSpace>

Pushes a new element to the front of the destaque.

( 1 2 -- 3 1 2 )

§Errors

Returns NotEnoughSpace if the destaque is full.

§Examples
let mut q = DestaqueU8::<u8, 3>::default();
q.push_front(1)?;
q.push_front(2)?;
q.push_front(3)?;
assert_eq![q.to_array(), Some([3, 2, 1])];
Source

pub fn push_front_unchecked(&mut self, element: T)

Unchecked version of push_front.

§Panics

Panics if the destaque is full.

Source

pub fn push_front_override(&mut self, element: T) -> bool

Pushes a new element to the front of the destaque, overriding an element from the back if the destaque is full.

Returns true if an element was overridden, and false otherwise.

§Examples
let mut q = DestaqueU8::<_, 3>::from([1, 2]);
assert_eq!(q.push_front_override(3), false);
assert_eq![q.to_array(), Some([3, 1, 2])];
assert_eq!(q.push_front_override(4), true);
assert_eq![q.to_array(), Some([4, 3, 1])];
Source

pub fn push_back(&mut self, element: T) -> Result<(), NotEnoughSpace>

Pushes a new element to the back of the destaque.

This is the habitual enqueue operation for a single-ended queue.

( 1 2 -- 1 2 3 )

§Errors

Returns NotEnoughSpace if the destaque is full.

§Examples
let mut q = DestaqueU8::<u8, 3>::default();
q.push_back(1)?;
q.push_back(2)?;
q.push_back(3)?;
assert_eq![q.to_array(), Some([1, 2, 3])];
Source

pub fn enqueue(&mut self, element: T) -> Result<(), NotEnoughSpace>

Alias of push_back.

This is the habitual enqueue operation for a single-ended queue.

Source

pub fn push_back_unchecked(&mut self, element: T)

Unchecked version of push_back.

§Panics

Panics if the destaque is full.

Source

pub fn push_back_override(&mut self, element: T) -> bool

Pushes a new element to the back of the destaque, overriding the first element if the destaque is full.

Returns true if an element was overridden, and false otherwise.

§Examples
let mut q = DestaqueU8::<_, 3>::from([1, 2]);
assert_eq!(q.push_back_override(3), false);
assert_eq![q.to_array(), Some([1, 2, 3])];
assert_eq!(q.push_back_override(4), true);
assert_eq![q.to_array(), Some([2, 3, 4])];
Source

pub fn pop_front(&mut self) -> Result<T, NotEnoughElements>

Available on crate feature unsafe_ptr or Clone only.

Pops the front element.

This is the habitual dequeue operation for a signle-ended queue.

( 1 2 -- 2 )

§Errors

Returns NotEnoughElements if the queue is empty.

§Examples

let mut q = DestaqueU8::<_, 8>::from([1, 2, 3]);
assert_eq![1, q.pop_front()?];
assert_eq![2, q.pop_front()?];
assert_eq![3, q.pop_front()?];
assert![q.is_empty()];
§Features

It’s depends on T: Clone, unless the unsafe_ptr feature is enabled.

Source

pub fn dequeue(&mut self) -> Result<T, NotEnoughElements>

Available on crate feature unsafe_ptr or Clone only.

Alias of pop_front.

This is the habitual dequeue operation for a single-ended queue.

Source

pub fn pop_back(&mut self) -> Result<T, NotEnoughElements>

Available on crate feature unsafe_ptr or Clone only.

Pops the back element.

( 1 2-- 1 )

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueU8::<_, 8>::from([1, 2, 3]);
assert_eq![3, q.pop_back()?];
assert_eq![2, q.pop_back()?];
assert_eq![1, q.pop_back()?];
assert![q.is_empty()];
§Features

It’s depends on T: Clone, unless the unsafe_ptr feature is enabled.

Source

pub fn peek_back(&self) -> Result<&T, NotEnoughElements>

Returns a shared reference to the back element.

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let q = DestaqueU8::<_, 8>::from([1, 2, 3]);
assert_eq![&3, q.peek_back()?];
Source

pub fn peek_back_mut(&mut self) -> Result<&mut T, NotEnoughElements>

Returns an exclusive reference to the back element.

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueU8::<_, 8>::from([1, 2, 3]);
assert_eq![&mut 3, q.peek_back_mut()?];
Source

pub fn peek_nth_back(&self, nth: u8) -> Result<&T, NotEnoughElements>

Returns a shared reference to the nth back element.

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least nth elements.

§Examples
let q = DestaqueU8::<_, 8>::from([1, 2, 3]);
assert_eq![&1, q.peek_nth_back(2)?];
Source

pub fn peek_nth_back_mut( &mut self, nth: u8, ) -> Result<&mut T, NotEnoughElements>

Returns an exclusive reference to the nth back element.

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least nth elements.

§Examples
let mut q = DestaqueU8::<_, 8>::from([1, 2, 3]);
assert_eq![&mut 1, q.peek_nth_back_mut(2)?];
Source

pub fn peek_front(&self) -> Result<&T, NotEnoughElements>

Returns a shared reference to the front element.

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let q = DestaqueU8::<_, 8>::from([1, 2, 3]);
assert_eq![&1, q.peek_front()?];
Source

pub fn peek_front_mut(&mut self) -> Result<&mut T, NotEnoughElements>

Returns an exclusive reference to the front element.

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueU8::<_, 8>::from([1, 2, 3]);
assert_eq![&mut 1, q.peek_front_mut()?];
Source

pub fn peek_nth_front(&self, nth: u8) -> Result<&T, NotEnoughElements>

Returns a shared reference to the nth front element.

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least nth elements.

§Examples
let q = DestaqueU8::<_, 8>::from([1, 2, 3, 4]);
assert_eq![&3, q.peek_nth_front(2)?];
Source

pub fn peek_nth_front_mut( &mut self, nth: u8, ) -> Result<&mut T, NotEnoughElements>

Returns an exclusive reference to the nth front element.

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least nth elements.

§Examples
let mut q = DestaqueU8::<_, 8>::from([1, 2, 3, 4]);
assert_eq![&mut 3, q.peek_nth_front_mut(2)?];
Source

pub const fn clear(&mut self)

Clears the destaque.

( 1 2 -- )

§Examples
let mut q = DestaqueU8::<_, 8>::from([1, 2, 3, 4]);
q.clear();
assert![q.is_empty()];
Source

pub fn drop_back(&mut self) -> Result<(), NotEnoughElements>

Drops the back element.

( 1 2 -- 1 )

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueU8::<_, 8>::from([1, 2]);
q.drop_back()?;
assert_eq![q.to_array(), Some([1])];
Source

pub fn drop_front(&mut self) -> Result<(), NotEnoughElements>

Drops the front element.

( 1 2 -- 2 )

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueU8::<_, 8>::from([1, 2]);
q.drop_front()?;
assert_eq![q.to_array(), Some([2])];
Source

pub fn drop_n_back(&mut self, nth: u8) -> Result<(), NotEnoughElements>

Drops n elements from the back.

( 1 2 3 4 -- 1 ) for n = 3

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least nth elements.

§Examples
let mut q = DestaqueU8::<_, 8>::from([1, 2, 3, 4]);
q.drop_n_back(3)?;
assert_eq![q.to_array(), Some([1])];
Source

pub fn drop_n_front(&mut self, nth: u8) -> Result<(), NotEnoughElements>

Drops n elements from the front.

( 1 2 3 4 -- 4 ) for n = 3

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least nth elements.

§Examples
let mut q = DestaqueU8::<_, 8>::from([1, 2, 3, 4]);
q.drop_n_front(3)?;
assert_eq![q.to_array(), Some([4])];
Source

pub fn swap_back(&mut self) -> Result<(), NotEnoughElements>

Swaps the last two elements at the back of the destaque.

( 1 2 3 4 -- 1 2 4 3 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 2 elements.

§Examples
let mut q = DestaqueU8::<_, 4>::from([1, 2, 3, 4]);
q.swap_back();
assert_eq![q.to_array(), Some([1, 2, 4, 3])];
Source

pub fn swap_back_unchecked(&mut self)

Unchecked version of swap_back.

§Panics

Panics if the destaque doesn’t contain at least 2 elements.

Source

pub fn swap_front(&mut self) -> Result<(), NotEnoughElements>

Swaps the first two elements at the front of the destaque.

( 1 2 3 4 -- 2 1 3 4 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 2 elements.

§Examples
let mut q = DestaqueU8::<_, 4>::from([1, 2, 3, 4]);
q.swap_front();
assert_eq![q.to_array(), Some([2, 1, 3, 4])];
Source

pub fn swap_front_unchecked(&mut self)

Unchecked version of swap_front.

§Panics

Panics if the destaque doesn’t contain at least 2 elements.

Source

pub fn swap2_back(&mut self) -> Result<(), NotEnoughElements>

Swaps the last two pairs of elements at the back of the destaque.

( 1 2 3 4 5 6 7 8 -- 1 2 3 4 7 8 5 6 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 2 elements.

§Examples
let mut q = DestaqueU8::<_, 16>::from([1, 2, 3, 4, 5, 6, 7, 8]);
q.swap2_back();
assert_eq![q.to_array(), Some([1, 2, 3, 4, 7, 8, 5, 6])];
Source

pub fn swap2_back_unchecked(&mut self)

Unchecked version of swap2_back.

§Panics

Panics if the destaque doesn’t contain at least 2 elements.

Source

pub fn swap2_front(&mut self) -> Result<(), NotEnoughElements>

Swaps the first two pairs of elements at the front of the destaque. ( 1 2 3 4 5 6 7 8 -- 3 4 1 2 5 6 7 8 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 4 elements.

§Examples
let mut q = DestaqueU8::<_, 16>::from([1, 2, 3, 4, 5, 6, 7, 8]);
q.swap2_front();
assert_eq![q.to_array(), Some([3, 4, 1, 2, 5, 6, 7, 8])];
Source

pub fn swap2_front_unchecked(&mut self)

Unchecked version of swap2_back.

§Panics

Panics if the destaque doesn’t contain at least 2 elements.

Source

pub fn swap_ends(&mut self) -> Result<(), NotEnoughElements>

Swaps the front and back elements.

( 1 2 3 4 -- 4 2 3 1 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 2 elements.

§Examples
let mut q = DestaqueU8::<_, 6>::from([1, 2, 3, 4, 5]);
q.swap_ends();
assert_eq![q.to_array(), Some([5, 2, 3, 4, 1])];
Source

pub fn swap2_ends(&mut self) -> Result<(), NotEnoughElements>

Swaps the front and back pairs of elements.

( 1 2 3 4 5 6 7 8 -- 7 8 3 4 5 6 1 2 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 4 elements.

§Examples
let mut q = DestaqueU8::<_, 16>::from([1, 2, 3, 4, 5, 6, 7, 8]);
q.swap2_ends();
assert_eq![q.to_array(), Some([7, 8, 3, 4, 5, 6, 1, 2])];
Source

pub fn rot_right(&mut self)

Rotates all the destaqued elements one place to the right.

( 1 2 3 4 -- 4 1 2 3 )

§Examples
let mut q = DestaqueU8::<i32, 8>::from([2, 3]);
q.push_front(1)?;
q.push_back(4)?;
assert_eq![q.to_array(), Some([1, 2, 3, 4])];
q.rot_right();
assert_eq![q.to_array(), Some([4, 1, 2, 3])];
Source

pub fn rot_right_n(&mut self, nth: u8)

Rotates all the destaqued elements n places to the right.

( 1 2 3 4 -- 2 3 4 1 ) for n = 3

§Examples
let mut q = DestaqueU8::<i32, 8>::from([2, 3]);
q.push_front(1)?;
q.push_back(4)?;
assert_eq![q.to_array(), Some([1, 2, 3, 4])];
q.rot_right_n(3);
assert_eq![q.to_array(), Some([2, 3, 4, 1])];
Source

pub fn rot_left(&mut self)

Rotates all the destaqued elements one place to the left.

( 1 2 3 4 -- 2 3 4 1 )

§Examples
let mut q = DestaqueU8::<i32, 8>::from([2, 3]);
q.push_front(1)?;
q.push_back(4)?;
assert_eq![q.to_array(), Some([1, 2, 3, 4])];
q.rot_left();
assert_eq![q.to_array(), Some([2, 3, 4, 1])];
Source

pub fn rot_left_n(&mut self, nth: u8)

Rotates all the destaqued elements n places to the left.

( 1 2 3 4 -- 4 1 2 3 ) for nth = 3

§Examples
let mut q = DestaqueU8::<i32, 8>::from([2, 3]);
q.push_front(1)?;
q.push_back(4)?;
assert_eq![q.to_array(), Some([1, 2, 3, 4])];
q.rot_left_n(3);
assert_eq![q.to_array(), Some([4, 1, 2, 3])];
Source§

impl<T: Clone, const CAP: usize, S: Storage> Destaque<T, CAP, u8, S>

Source

pub fn make_contiguous(&mut self, element: T) -> &mut [T]

Makes the elements of the destaque contiguous, rearranging the elements so that they are in a single, continuous block starting from the front.

This operation might rearrange the internal representation of the elements to ensure they are contiguous. It clones the default element provided during the destaque’s construction to fill any gaps if necessary.

Returns a mutable slice to the now contiguous elements.

§Examples

let mut q = DestaqueU8::<_, 5>::new(0).unwrap();
q.push_back(1);
q.push_back(2);
q.push_front(5);
assert_eq!(q.as_slices(), (&[5][..], &[1, 2][..]));

assert_eq!(q.make_contiguous(0), &[5, 1, 2]);
assert_eq!(q.as_slices(), (&[5, 1, 2][..], &[][..]));
Source

pub fn to_vec(&self) -> Vec<T>

Available on crate feature alloc only.

Returns the destaqued elements as a vector.

§Examples
let mut q = DestaqueU8::<_, 5>::from([3, 4]);
q.push_front(2)?;
q.push_back(5)?;
q.push_front(1)?;
assert_eq![q.to_vec(), vec![1, 2, 3, 4, 5]];
Source

pub fn to_array<const LEN: usize>(&self) -> Option<[T; LEN]>

Returns some LEN destaqued elements as an array, or None if the destaque is empty, or there are not at least LEN elements.

This is a non alloc alternative method to to_vec.

§Panics

Panics if the new LEN sized array can’t be allocated.

§Examples
let mut q = DestaqueU8::<_, 5>::from([3, 4]);
q.push_front(2)?;
q.push_back(5)?;
q.push_front(1)?;
assert_eq![q.to_array::<5>(), Some([1, 2, 3, 4, 5])];
§Features

Makes use of the unsafe_array feature if enabled.

Source

pub fn dup_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the back element at the back

( 1 2 -- 1 2 2 )

§Errors

Returns NotEnoughElements if the destaque is empty or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueU8::<u8, 4>::from([1, 2, 3]);
q.dup_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 3])];
Source

pub fn dup_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the front element at the front.

( 1 2 -- 1 1 2 )

§Errors

Returns NotEnoughElements if the destaque is empty or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueU8::<u8, 4>::from([1, 2, 3]);
q.dup_front()?;
assert_eq![q.to_array(), Some([1, 1, 2, 3])];
Source

pub fn dup2_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the back pair of elements, at the back.

( 1 2 3 4 -- 1 2 3 4 3 4)

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU8::<u8, 6>::from([1, 2, 3, 4]);
q.dup2_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 4, 3, 4])];
Source

pub fn dup2_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the front pair of elements, at the front.

( 1 2 3 4 -- 1 2 1 2 3 4)

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU8::<u8, 6>::from([1, 2, 3, 4]);
q.dup2_front()?;
assert_eq![q.to_array(), Some([1, 2, 1, 2, 3, 4])];
Source

pub fn over_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the second back element, at the back.

( 1 2 3 4 -- 1 2 3 4 3 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueU8::<u8, 7>::from([1, 2, 3, 4]);
q.over_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 4, 3])];
Source

pub fn over_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the second front element, at the front.

( 1 2 3 4 -- 2 1 2 3 4 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueU8::<u8, 7>::from([1, 2, 3, 4]);
q.over_front()?;
assert_eq![q.to_array(), Some([2, 1, 2, 3, 4])];
Source

pub fn over2_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the second back pair of elements, at the back.

( 1 2 3 4 5 6 7 8 -- 1 2 3 4 5 6 7 8 5 6 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 4 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU8::<u8, 8>::from([1, 2, 3, 4, 5, 6]);
q.over2_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 4, 5, 6, 3, 4])];
Source

pub fn over2_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the second front pair of elements, at the front.

( 1 2 3 4 5 6 7 8 -- 3 4 1 2 3 4 5 6 7 8 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 4 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU8::<u8, 8>::from([1, 2, 3, 4, 5, 6]);
q.over2_front()?;
assert_eq![q.to_array(), Some([3, 4, 1, 2, 3, 4, 5, 6])];
Source

pub fn tuck_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the back element, before the second back element.

( 1 2 3 4 -- 1 2 4 3 4 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it is full.

§Examples

let mut q = DestaqueU8::<u8, 7>::from([1, 2, 3, 4, 5]);
q.tuck_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 5, 4, 5])];
Source

pub fn tuck_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the front element, after the second front element.

( 1 2 3 4 -- 1 2 1 3 4 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueU8::<u8, 7>::from([1, 2, 3, 4, 5]);
q.tuck_front()?;
assert_eq![q.to_array(), Some([1, 2, 1, 3, 4, 5])];
Source

pub fn tuck2_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the back pair of elements, before the second back pair of elements.

( 1 2 3 4 5 6 7 8 -- 1 2 3 4 7 8 5 6 7 8 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 4 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU8::<u8, 7>::from([1, 2, 3, 4, 5]);
q.tuck2_back()?;
assert_eq![q.to_array(), Some([1, 4, 5, 2, 3, 4, 5])];
Source

pub fn tuck2_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the front pair of elements, after the second front pair of elements.

( 1 2 3 4 5 6 7 8 -- 1 2 3 4 1 2 5 6 7 8 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 4 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU8::<u8, 7>::from([1, 2, 3, 4, 5]);
q.tuck2_front()?;
assert_eq![q.to_array(), Some([1, 2, 3, 4, 1, 2, 5])];
Source§

impl<T, const CAP: usize, S: Storage> Destaque<T, CAP, u8, S>

Source

pub const fn iter(&self) -> DestaqueIter<'_, T, CAP, u8, S>

Returns an iterator.

Source

pub fn extend_back<I>(&mut self, iterator: I) -> Result<(), NotEnoughSpace>
where I: IntoIterator<Item = T>,

Extends the back of the destaque from an iterator.

( 1 2 -- 1 2 3 4 5 6) for [3 4 5 6]

§Errors

Returns NotEnoughSpace if the destaque becomes full before the iterator finishes.

§Examples
let mut q = DestaqueU8::<_, 6>::from([1, 2, 3]);
q.extend_back([4, 5, 6, 7, 8]);
assert_eq![q.to_array(), Some([1, 2, 3, 4, 5, 6])];
Source

pub fn extend_back_override<I>(&mut self, iterator: I) -> bool
where I: IntoIterator<Item = T>,

Extends the back of the destaque from an iterator, overriding elements from the front if the destaque is full.

( 1 2 3 -- 3 4 5 6) for [4 5 6] and CAP = 4

§Examples
let mut q = DestaqueU8::<_, 4>::from([1, 2, 3]);
assert_eq![q.extend_back_override([4, 5, 6]), true];
assert_eq![q.to_array(), Some([3, 4, 5, 6])];
Source

pub fn extend_front<I>(&mut self, iterator: I) -> Result<(), NotEnoughSpace>
where I: IntoIterator<Item = T>,

Extends the front of the destaque from an iterator.

( 1 2 -- 6 5 4 3 1 2 ) for [3 4 5 6]

§Errors

Returns NotEnoughSpace if the destaque becomes full before the iterator finishes.

§Examples
let mut q = DestaqueU8::<_, 6>::from([1, 2, 3]);
q.extend_front([4, 5, 6, 7, 8]);
assert_eq![q.to_array(), Some([6, 5, 4, 1, 2, 3])];
Source

pub fn extend_front_override<I>(&mut self, iterator: I) -> bool
where I: IntoIterator<Item = T>,

Extends the front of the destaque from an iterator, overriding elements from the back if the destaque is full.

( 1 2 3 -- 6 5 4 1) for [4 5 6] and CAP = 4

§Examples
let mut q = DestaqueU8::<_, 4>::from([1, 2, 3]);
assert_eq![q.extend_front_override([4, 5, 6]), true];
assert_eq![q.to_array(), Some([6, 5, 4, 1])];
Source§

impl<T: PartialEq, const CAP: usize, S: Storage> Destaque<T, CAP, u8, S>

Source

pub fn contains(&self, element: &T) -> bool

Returns true if the destaque contains element.

§Examples
let q = DestaqueU8::<_, 6>::from([5, 78, 42, 33, 9]);

assert![q.contains(&9)];
assert![!q.contains(&8)];
Source§

impl<T: Clone, const CAP: usize> Destaque<T, CAP, u16, Bare>

§Methods for DestaqueU16



This impl block contains no items.
Source§

impl<T: Clone, const CAP: usize> Destaque<T, CAP, u16, Bare>

Source

pub fn new(element: T) -> Result<Self, MismatchedCapacity>

Returns an empty destaque, allocated in the stack, cloning element to fill the remaining free data.

§Errors

Returns MismatchedCapacity if CAP > u16::MAX or if CAP > isize::MAX / size_of::<T>().

§Examples
let q = DestaqueU16::<_, 16>::new(0).unwrap();
Source§

impl<T: Copy, const CAP: usize> Destaque<T, CAP, u16, Bare>

Source

pub const fn new_copied(element: T) -> Result<Self, MismatchedCapacity>

Returns an empty destaque, allocated in the stack, copying element to fill the remaining free data, in compile-time.

§Errors

Returns MismatchedCapacity if CAP > u16::MAX or if CAP > isize::MAX / size_of::<T>().

§Examples
const S: DestaqueU16<i32, 16> = unwrap![ok DestaqueU16::new_copied(0)];
Source§

impl<T: Clone, const CAP: usize> Destaque<T, CAP, u16, Boxed>

Source

pub fn new(element: T) -> Self

Available on crate feature alloc only.

Returns an empty destaque, allocated in the heap, cloning element to fill the remaining free data.

§Examples
let q = DestaqueU16::<_, 3, Boxed>::new(0);
Source§

impl<T, const CAP: usize> Destaque<T, CAP, u16, Bare>

Source

pub const fn from_array_copy(arr: [T; CAP]) -> Destaque<T, CAP, u16, Bare>

Converts an array into a full destaque.

§Examples
let q = DestaqueU16::<_, 3>::from_array([1, 2, 3]);
Source§

impl<T, const CAP: usize, S: Storage> Destaque<T, CAP, u16, S>

Source

pub fn from_array(arr: [T; CAP]) -> Destaque<T, CAP, u16, S>

Converts an array into a full destaque.

§Examples
let q = DestaqueU16::<_, 3>::from_array([1, 2, 3]);
Source

pub const fn len(&self) -> u16

Returns the number of destaqued elements.

Source

pub const fn is_empty(&self) -> bool

Returns true if the destaque is empty.

§Examples
let q = DestaqueU16::<i32, 8>::default();
assert![q.is_empty()];
Source

pub const fn is_full(&self) -> bool

Returns true if the destaque is full.

§Examples
let q = DestaqueU16::<_, 3>::from([1, 2, 3]);
assert![q.is_full()];
Source

pub const fn capacity(&self) -> u16

Returns the destaque’s total capacity.

§Examples
let q = DestaqueU16::<i32, 3>::default();
assert_eq![3, q.capacity()];
Source

pub const fn remaining_capacity(&self) -> u16

Returns the destaque’s remaining capacity.

§Examples
let mut q = DestaqueU16::<i32, 3>::default();
assert_eq![3, q.remaining_capacity()];
q.push_back(1)?;
assert_eq![2, q.remaining_capacity()];
Source

pub fn as_slices(&self) -> (&[T], &[T])

Returns the destaque as pair of shared slices, which contain, in order, the contents of the destaque.

§Examples
let q = DestaqueU16::<_, 3>::from([1, 2, 3]);
assert_eq![q.as_slices(), (&[1, 2, 3][..], &[][..])];
Source

pub const fn is_contiguous(&self) -> bool

Returns true if the destaque is contiguous.

§Examples
let mut q = DestaqueU16::<_, 3>::from([1, 2, 3]);
assert_eq![q.as_slices(), (&[1, 2, 3][..], &[][..])];
assert![q.is_contiguous()];
q.pop_back()?;
q.push_front(4)?;
assert![!q.is_contiguous()];
assert_eq![q.as_slices(), (&[4][..], &[1, 2][..])];
Source

pub fn push_front(&mut self, element: T) -> Result<(), NotEnoughSpace>

Pushes a new element to the front of the destaque.

( 1 2 -- 3 1 2 )

§Errors

Returns NotEnoughSpace if the destaque is full.

§Examples
let mut q = DestaqueU16::<u8, 3>::default();
q.push_front(1)?;
q.push_front(2)?;
q.push_front(3)?;
assert_eq![q.to_array(), Some([3, 2, 1])];
Source

pub fn push_front_unchecked(&mut self, element: T)

Unchecked version of push_front.

§Panics

Panics if the destaque is full.

Source

pub fn push_front_override(&mut self, element: T) -> bool

Pushes a new element to the front of the destaque, overriding an element from the back if the destaque is full.

Returns true if an element was overridden, and false otherwise.

§Examples
let mut q = DestaqueU16::<_, 3>::from([1, 2]);
assert_eq!(q.push_front_override(3), false);
assert_eq![q.to_array(), Some([3, 1, 2])];
assert_eq!(q.push_front_override(4), true);
assert_eq![q.to_array(), Some([4, 3, 1])];
Source

pub fn push_back(&mut self, element: T) -> Result<(), NotEnoughSpace>

Pushes a new element to the back of the destaque.

This is the habitual enqueue operation for a single-ended queue.

( 1 2 -- 1 2 3 )

§Errors

Returns NotEnoughSpace if the destaque is full.

§Examples
let mut q = DestaqueU16::<u8, 3>::default();
q.push_back(1)?;
q.push_back(2)?;
q.push_back(3)?;
assert_eq![q.to_array(), Some([1, 2, 3])];
Source

pub fn enqueue(&mut self, element: T) -> Result<(), NotEnoughSpace>

Alias of push_back.

This is the habitual enqueue operation for a single-ended queue.

Source

pub fn push_back_unchecked(&mut self, element: T)

Unchecked version of push_back.

§Panics

Panics if the destaque is full.

Source

pub fn push_back_override(&mut self, element: T) -> bool

Pushes a new element to the back of the destaque, overriding the first element if the destaque is full.

Returns true if an element was overridden, and false otherwise.

§Examples
let mut q = DestaqueU16::<_, 3>::from([1, 2]);
assert_eq!(q.push_back_override(3), false);
assert_eq![q.to_array(), Some([1, 2, 3])];
assert_eq!(q.push_back_override(4), true);
assert_eq![q.to_array(), Some([2, 3, 4])];
Source

pub fn pop_front(&mut self) -> Result<T, NotEnoughElements>

Available on crate feature unsafe_ptr or Clone only.

Pops the front element.

This is the habitual dequeue operation for a signle-ended queue.

( 1 2 -- 2 )

§Errors

Returns NotEnoughElements if the queue is empty.

§Examples

let mut q = DestaqueU16::<_, 8>::from([1, 2, 3]);
assert_eq![1, q.pop_front()?];
assert_eq![2, q.pop_front()?];
assert_eq![3, q.pop_front()?];
assert![q.is_empty()];
§Features

It’s depends on T: Clone, unless the unsafe_ptr feature is enabled.

Source

pub fn dequeue(&mut self) -> Result<T, NotEnoughElements>

Available on crate feature unsafe_ptr or Clone only.

Alias of pop_front.

This is the habitual dequeue operation for a single-ended queue.

Source

pub fn pop_back(&mut self) -> Result<T, NotEnoughElements>

Available on crate feature unsafe_ptr or Clone only.

Pops the back element.

( 1 2-- 1 )

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueU16::<_, 8>::from([1, 2, 3]);
assert_eq![3, q.pop_back()?];
assert_eq![2, q.pop_back()?];
assert_eq![1, q.pop_back()?];
assert![q.is_empty()];
§Features

It’s depends on T: Clone, unless the unsafe_ptr feature is enabled.

Source

pub fn peek_back(&self) -> Result<&T, NotEnoughElements>

Returns a shared reference to the back element.

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let q = DestaqueU16::<_, 8>::from([1, 2, 3]);
assert_eq![&3, q.peek_back()?];
Source

pub fn peek_back_mut(&mut self) -> Result<&mut T, NotEnoughElements>

Returns an exclusive reference to the back element.

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueU16::<_, 8>::from([1, 2, 3]);
assert_eq![&mut 3, q.peek_back_mut()?];
Source

pub fn peek_nth_back(&self, nth: u16) -> Result<&T, NotEnoughElements>

Returns a shared reference to the nth back element.

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least nth elements.

§Examples
let q = DestaqueU16::<_, 8>::from([1, 2, 3]);
assert_eq![&1, q.peek_nth_back(2)?];
Source

pub fn peek_nth_back_mut( &mut self, nth: u16, ) -> Result<&mut T, NotEnoughElements>

Returns an exclusive reference to the nth back element.

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least nth elements.

§Examples
let mut q = DestaqueU16::<_, 8>::from([1, 2, 3]);
assert_eq![&mut 1, q.peek_nth_back_mut(2)?];
Source

pub fn peek_front(&self) -> Result<&T, NotEnoughElements>

Returns a shared reference to the front element.

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let q = DestaqueU16::<_, 8>::from([1, 2, 3]);
assert_eq![&1, q.peek_front()?];
Source

pub fn peek_front_mut(&mut self) -> Result<&mut T, NotEnoughElements>

Returns an exclusive reference to the front element.

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueU16::<_, 8>::from([1, 2, 3]);
assert_eq![&mut 1, q.peek_front_mut()?];
Source

pub fn peek_nth_front(&self, nth: u16) -> Result<&T, NotEnoughElements>

Returns a shared reference to the nth front element.

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least nth elements.

§Examples
let q = DestaqueU16::<_, 8>::from([1, 2, 3, 4]);
assert_eq![&3, q.peek_nth_front(2)?];
Source

pub fn peek_nth_front_mut( &mut self, nth: u16, ) -> Result<&mut T, NotEnoughElements>

Returns an exclusive reference to the nth front element.

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least nth elements.

§Examples
let mut q = DestaqueU16::<_, 8>::from([1, 2, 3, 4]);
assert_eq![&mut 3, q.peek_nth_front_mut(2)?];
Source

pub const fn clear(&mut self)

Clears the destaque.

( 1 2 -- )

§Examples
let mut q = DestaqueU16::<_, 8>::from([1, 2, 3, 4]);
q.clear();
assert![q.is_empty()];
Source

pub fn drop_back(&mut self) -> Result<(), NotEnoughElements>

Drops the back element.

( 1 2 -- 1 )

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueU16::<_, 8>::from([1, 2]);
q.drop_back()?;
assert_eq![q.to_array(), Some([1])];
Source

pub fn drop_front(&mut self) -> Result<(), NotEnoughElements>

Drops the front element.

( 1 2 -- 2 )

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueU16::<_, 8>::from([1, 2]);
q.drop_front()?;
assert_eq![q.to_array(), Some([2])];
Source

pub fn drop_n_back(&mut self, nth: u16) -> Result<(), NotEnoughElements>

Drops n elements from the back.

( 1 2 3 4 -- 1 ) for n = 3

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least nth elements.

§Examples
let mut q = DestaqueU16::<_, 8>::from([1, 2, 3, 4]);
q.drop_n_back(3)?;
assert_eq![q.to_array(), Some([1])];
Source

pub fn drop_n_front(&mut self, nth: u16) -> Result<(), NotEnoughElements>

Drops n elements from the front.

( 1 2 3 4 -- 4 ) for n = 3

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least nth elements.

§Examples
let mut q = DestaqueU16::<_, 8>::from([1, 2, 3, 4]);
q.drop_n_front(3)?;
assert_eq![q.to_array(), Some([4])];
Source

pub fn swap_back(&mut self) -> Result<(), NotEnoughElements>

Swaps the last two elements at the back of the destaque.

( 1 2 3 4 -- 1 2 4 3 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 2 elements.

§Examples
let mut q = DestaqueU16::<_, 4>::from([1, 2, 3, 4]);
q.swap_back();
assert_eq![q.to_array(), Some([1, 2, 4, 3])];
Source

pub fn swap_back_unchecked(&mut self)

Unchecked version of swap_back.

§Panics

Panics if the destaque doesn’t contain at least 2 elements.

Source

pub fn swap_front(&mut self) -> Result<(), NotEnoughElements>

Swaps the first two elements at the front of the destaque.

( 1 2 3 4 -- 2 1 3 4 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 2 elements.

§Examples
let mut q = DestaqueU16::<_, 4>::from([1, 2, 3, 4]);
q.swap_front();
assert_eq![q.to_array(), Some([2, 1, 3, 4])];
Source

pub fn swap_front_unchecked(&mut self)

Unchecked version of swap_front.

§Panics

Panics if the destaque doesn’t contain at least 2 elements.

Source

pub fn swap2_back(&mut self) -> Result<(), NotEnoughElements>

Swaps the last two pairs of elements at the back of the destaque.

( 1 2 3 4 5 6 7 8 -- 1 2 3 4 7 8 5 6 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 2 elements.

§Examples
let mut q = DestaqueU16::<_, 16>::from([1, 2, 3, 4, 5, 6, 7, 8]);
q.swap2_back();
assert_eq![q.to_array(), Some([1, 2, 3, 4, 7, 8, 5, 6])];
Source

pub fn swap2_back_unchecked(&mut self)

Unchecked version of swap2_back.

§Panics

Panics if the destaque doesn’t contain at least 2 elements.

Source

pub fn swap2_front(&mut self) -> Result<(), NotEnoughElements>

Swaps the first two pairs of elements at the front of the destaque. ( 1 2 3 4 5 6 7 8 -- 3 4 1 2 5 6 7 8 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 4 elements.

§Examples
let mut q = DestaqueU16::<_, 16>::from([1, 2, 3, 4, 5, 6, 7, 8]);
q.swap2_front();
assert_eq![q.to_array(), Some([3, 4, 1, 2, 5, 6, 7, 8])];
Source

pub fn swap2_front_unchecked(&mut self)

Unchecked version of swap2_back.

§Panics

Panics if the destaque doesn’t contain at least 2 elements.

Source

pub fn swap_ends(&mut self) -> Result<(), NotEnoughElements>

Swaps the front and back elements.

( 1 2 3 4 -- 4 2 3 1 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 2 elements.

§Examples
let mut q = DestaqueU16::<_, 6>::from([1, 2, 3, 4, 5]);
q.swap_ends();
assert_eq![q.to_array(), Some([5, 2, 3, 4, 1])];
Source

pub fn swap2_ends(&mut self) -> Result<(), NotEnoughElements>

Swaps the front and back pairs of elements.

( 1 2 3 4 5 6 7 8 -- 7 8 3 4 5 6 1 2 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 4 elements.

§Examples
let mut q = DestaqueU16::<_, 16>::from([1, 2, 3, 4, 5, 6, 7, 8]);
q.swap2_ends();
assert_eq![q.to_array(), Some([7, 8, 3, 4, 5, 6, 1, 2])];
Source

pub fn rot_right(&mut self)

Rotates all the destaqued elements one place to the right.

( 1 2 3 4 -- 4 1 2 3 )

§Examples
let mut q = DestaqueU16::<i32, 8>::from([2, 3]);
q.push_front(1)?;
q.push_back(4)?;
assert_eq![q.to_array(), Some([1, 2, 3, 4])];
q.rot_right();
assert_eq![q.to_array(), Some([4, 1, 2, 3])];
Source

pub fn rot_right_n(&mut self, nth: u16)

Rotates all the destaqued elements n places to the right.

( 1 2 3 4 -- 2 3 4 1 ) for n = 3

§Examples
let mut q = DestaqueU16::<i32, 8>::from([2, 3]);
q.push_front(1)?;
q.push_back(4)?;
assert_eq![q.to_array(), Some([1, 2, 3, 4])];
q.rot_right_n(3);
assert_eq![q.to_array(), Some([2, 3, 4, 1])];
Source

pub fn rot_left(&mut self)

Rotates all the destaqued elements one place to the left.

( 1 2 3 4 -- 2 3 4 1 )

§Examples
let mut q = DestaqueU16::<i32, 8>::from([2, 3]);
q.push_front(1)?;
q.push_back(4)?;
assert_eq![q.to_array(), Some([1, 2, 3, 4])];
q.rot_left();
assert_eq![q.to_array(), Some([2, 3, 4, 1])];
Source

pub fn rot_left_n(&mut self, nth: u16)

Rotates all the destaqued elements n places to the left.

( 1 2 3 4 -- 4 1 2 3 ) for nth = 3

§Examples
let mut q = DestaqueU16::<i32, 8>::from([2, 3]);
q.push_front(1)?;
q.push_back(4)?;
assert_eq![q.to_array(), Some([1, 2, 3, 4])];
q.rot_left_n(3);
assert_eq![q.to_array(), Some([4, 1, 2, 3])];
Source§

impl<T: Clone, const CAP: usize, S: Storage> Destaque<T, CAP, u16, S>

Source

pub fn make_contiguous(&mut self, element: T) -> &mut [T]

Makes the elements of the destaque contiguous, rearranging the elements so that they are in a single, continuous block starting from the front.

This operation might rearrange the internal representation of the elements to ensure they are contiguous. It clones the default element provided during the destaque’s construction to fill any gaps if necessary.

Returns a mutable slice to the now contiguous elements.

§Examples

let mut q = DestaqueU16::<_, 5>::new(0).unwrap();
q.push_back(1);
q.push_back(2);
q.push_front(5);
assert_eq!(q.as_slices(), (&[5][..], &[1, 2][..]));

assert_eq!(q.make_contiguous(0), &[5, 1, 2]);
assert_eq!(q.as_slices(), (&[5, 1, 2][..], &[][..]));
Source

pub fn to_vec(&self) -> Vec<T>

Available on crate feature alloc only.

Returns the destaqued elements as a vector.

§Examples
let mut q = DestaqueU16::<_, 5>::from([3, 4]);
q.push_front(2)?;
q.push_back(5)?;
q.push_front(1)?;
assert_eq![q.to_vec(), vec![1, 2, 3, 4, 5]];
Source

pub fn to_array<const LEN: usize>(&self) -> Option<[T; LEN]>

Returns some LEN destaqued elements as an array, or None if the destaque is empty, or there are not at least LEN elements.

This is a non alloc alternative method to to_vec.

§Panics

Panics if the new LEN sized array can’t be allocated.

§Examples
let mut q = DestaqueU16::<_, 5>::from([3, 4]);
q.push_front(2)?;
q.push_back(5)?;
q.push_front(1)?;
assert_eq![q.to_array::<5>(), Some([1, 2, 3, 4, 5])];
§Features

Makes use of the unsafe_array feature if enabled.

Source

pub fn dup_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the back element at the back

( 1 2 -- 1 2 2 )

§Errors

Returns NotEnoughElements if the destaque is empty or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueU16::<u8, 4>::from([1, 2, 3]);
q.dup_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 3])];
Source

pub fn dup_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the front element at the front.

( 1 2 -- 1 1 2 )

§Errors

Returns NotEnoughElements if the destaque is empty or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueU16::<u8, 4>::from([1, 2, 3]);
q.dup_front()?;
assert_eq![q.to_array(), Some([1, 1, 2, 3])];
Source

pub fn dup2_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the back pair of elements, at the back.

( 1 2 3 4 -- 1 2 3 4 3 4)

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU16::<u8, 6>::from([1, 2, 3, 4]);
q.dup2_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 4, 3, 4])];
Source

pub fn dup2_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the front pair of elements, at the front.

( 1 2 3 4 -- 1 2 1 2 3 4)

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU16::<u8, 6>::from([1, 2, 3, 4]);
q.dup2_front()?;
assert_eq![q.to_array(), Some([1, 2, 1, 2, 3, 4])];
Source

pub fn over_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the second back element, at the back.

( 1 2 3 4 -- 1 2 3 4 3 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueU16::<u8, 7>::from([1, 2, 3, 4]);
q.over_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 4, 3])];
Source

pub fn over_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the second front element, at the front.

( 1 2 3 4 -- 2 1 2 3 4 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueU16::<u8, 7>::from([1, 2, 3, 4]);
q.over_front()?;
assert_eq![q.to_array(), Some([2, 1, 2, 3, 4])];
Source

pub fn over2_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the second back pair of elements, at the back.

( 1 2 3 4 5 6 7 8 -- 1 2 3 4 5 6 7 8 5 6 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 4 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU16::<u8, 8>::from([1, 2, 3, 4, 5, 6]);
q.over2_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 4, 5, 6, 3, 4])];
Source

pub fn over2_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the second front pair of elements, at the front.

( 1 2 3 4 5 6 7 8 -- 3 4 1 2 3 4 5 6 7 8 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 4 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU16::<u8, 8>::from([1, 2, 3, 4, 5, 6]);
q.over2_front()?;
assert_eq![q.to_array(), Some([3, 4, 1, 2, 3, 4, 5, 6])];
Source

pub fn tuck_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the back element, before the second back element.

( 1 2 3 4 -- 1 2 4 3 4 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it is full.

§Examples

let mut q = DestaqueU16::<u8, 7>::from([1, 2, 3, 4, 5]);
q.tuck_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 5, 4, 5])];
Source

pub fn tuck_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the front element, after the second front element.

( 1 2 3 4 -- 1 2 1 3 4 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueU16::<u8, 7>::from([1, 2, 3, 4, 5]);
q.tuck_front()?;
assert_eq![q.to_array(), Some([1, 2, 1, 3, 4, 5])];
Source

pub fn tuck2_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the back pair of elements, before the second back pair of elements.

( 1 2 3 4 5 6 7 8 -- 1 2 3 4 7 8 5 6 7 8 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 4 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU16::<u8, 7>::from([1, 2, 3, 4, 5]);
q.tuck2_back()?;
assert_eq![q.to_array(), Some([1, 4, 5, 2, 3, 4, 5])];
Source

pub fn tuck2_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the front pair of elements, after the second front pair of elements.

( 1 2 3 4 5 6 7 8 -- 1 2 3 4 1 2 5 6 7 8 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 4 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU16::<u8, 7>::from([1, 2, 3, 4, 5]);
q.tuck2_front()?;
assert_eq![q.to_array(), Some([1, 2, 3, 4, 1, 2, 5])];
Source§

impl<T, const CAP: usize, S: Storage> Destaque<T, CAP, u16, S>

Source

pub const fn iter(&self) -> DestaqueIter<'_, T, CAP, u16, S>

Returns an iterator.

Source

pub fn extend_back<I>(&mut self, iterator: I) -> Result<(), NotEnoughSpace>
where I: IntoIterator<Item = T>,

Extends the back of the destaque from an iterator.

( 1 2 -- 1 2 3 4 5 6) for [3 4 5 6]

§Errors

Returns NotEnoughSpace if the destaque becomes full before the iterator finishes.

§Examples
let mut q = DestaqueU16::<_, 6>::from([1, 2, 3]);
q.extend_back([4, 5, 6, 7, 8]);
assert_eq![q.to_array(), Some([1, 2, 3, 4, 5, 6])];
Source

pub fn extend_back_override<I>(&mut self, iterator: I) -> bool
where I: IntoIterator<Item = T>,

Extends the back of the destaque from an iterator, overriding elements from the front if the destaque is full.

( 1 2 3 -- 3 4 5 6) for [4 5 6] and CAP = 4

§Examples
let mut q = DestaqueU16::<_, 4>::from([1, 2, 3]);
assert_eq![q.extend_back_override([4, 5, 6]), true];
assert_eq![q.to_array(), Some([3, 4, 5, 6])];
Source

pub fn extend_front<I>(&mut self, iterator: I) -> Result<(), NotEnoughSpace>
where I: IntoIterator<Item = T>,

Extends the front of the destaque from an iterator.

( 1 2 -- 6 5 4 3 1 2 ) for [3 4 5 6]

§Errors

Returns NotEnoughSpace if the destaque becomes full before the iterator finishes.

§Examples
let mut q = DestaqueU16::<_, 6>::from([1, 2, 3]);
q.extend_front([4, 5, 6, 7, 8]);
assert_eq![q.to_array(), Some([6, 5, 4, 1, 2, 3])];
Source

pub fn extend_front_override<I>(&mut self, iterator: I) -> bool
where I: IntoIterator<Item = T>,

Extends the front of the destaque from an iterator, overriding elements from the back if the destaque is full.

( 1 2 3 -- 6 5 4 1) for [4 5 6] and CAP = 4

§Examples
let mut q = DestaqueU16::<_, 4>::from([1, 2, 3]);
assert_eq![q.extend_front_override([4, 5, 6]), true];
assert_eq![q.to_array(), Some([6, 5, 4, 1])];
Source§

impl<T: PartialEq, const CAP: usize, S: Storage> Destaque<T, CAP, u16, S>

Source

pub fn contains(&self, element: &T) -> bool

Returns true if the destaque contains element.

§Examples
let q = DestaqueU16::<_, 6>::from([5, 78, 42, 33, 9]);

assert![q.contains(&9)];
assert![!q.contains(&8)];
Source§

impl<T: Clone, const CAP: usize> Destaque<T, CAP, u32, Bare>

§Methods for DestaqueU32



This impl block contains no items.
Source§

impl<T: Clone, const CAP: usize> Destaque<T, CAP, u32, Bare>

Source

pub fn new(element: T) -> Result<Self, MismatchedCapacity>

Returns an empty destaque, allocated in the stack, cloning element to fill the remaining free data.

§Errors

Returns MismatchedCapacity if CAP > u32::MAX or if CAP > isize::MAX / size_of::<T>().

§Examples
let q = DestaqueU32::<_, 16>::new(0).unwrap();
Source§

impl<T: Copy, const CAP: usize> Destaque<T, CAP, u32, Bare>

Source

pub const fn new_copied(element: T) -> Result<Self, MismatchedCapacity>

Returns an empty destaque, allocated in the stack, copying element to fill the remaining free data, in compile-time.

§Errors

Returns MismatchedCapacity if CAP > u32::MAX or if CAP > isize::MAX / size_of::<T>().

§Examples
const S: DestaqueU32<i32, 16> = unwrap![ok DestaqueU32::new_copied(0)];
Source§

impl<T: Clone, const CAP: usize> Destaque<T, CAP, u32, Boxed>

Source

pub fn new(element: T) -> Self

Available on crate feature alloc only.

Returns an empty destaque, allocated in the heap, cloning element to fill the remaining free data.

§Examples
let q = DestaqueU32::<_, 3, Boxed>::new(0);
Source§

impl<T, const CAP: usize> Destaque<T, CAP, u32, Bare>

Source

pub const fn from_array_copy(arr: [T; CAP]) -> Destaque<T, CAP, u32, Bare>

Converts an array into a full destaque.

§Examples
let q = DestaqueU32::<_, 3>::from_array([1, 2, 3]);
Source§

impl<T, const CAP: usize, S: Storage> Destaque<T, CAP, u32, S>

Source

pub fn from_array(arr: [T; CAP]) -> Destaque<T, CAP, u32, S>

Converts an array into a full destaque.

§Examples
let q = DestaqueU32::<_, 3>::from_array([1, 2, 3]);
Source

pub const fn len(&self) -> u32

Returns the number of destaqued elements.

Source

pub const fn is_empty(&self) -> bool

Returns true if the destaque is empty.

§Examples
let q = DestaqueU32::<i32, 8>::default();
assert![q.is_empty()];
Source

pub const fn is_full(&self) -> bool

Returns true if the destaque is full.

§Examples
let q = DestaqueU32::<_, 3>::from([1, 2, 3]);
assert![q.is_full()];
Source

pub const fn capacity(&self) -> u32

Returns the destaque’s total capacity.

§Examples
let q = DestaqueU32::<i32, 3>::default();
assert_eq![3, q.capacity()];
Source

pub const fn remaining_capacity(&self) -> u32

Returns the destaque’s remaining capacity.

§Examples
let mut q = DestaqueU32::<i32, 3>::default();
assert_eq![3, q.remaining_capacity()];
q.push_back(1)?;
assert_eq![2, q.remaining_capacity()];
Source

pub fn as_slices(&self) -> (&[T], &[T])

Returns the destaque as pair of shared slices, which contain, in order, the contents of the destaque.

§Examples
let q = DestaqueU32::<_, 3>::from([1, 2, 3]);
assert_eq![q.as_slices(), (&[1, 2, 3][..], &[][..])];
Source

pub const fn is_contiguous(&self) -> bool

Returns true if the destaque is contiguous.

§Examples
let mut q = DestaqueU32::<_, 3>::from([1, 2, 3]);
assert_eq![q.as_slices(), (&[1, 2, 3][..], &[][..])];
assert![q.is_contiguous()];
q.pop_back()?;
q.push_front(4)?;
assert![!q.is_contiguous()];
assert_eq![q.as_slices(), (&[4][..], &[1, 2][..])];
Source

pub fn push_front(&mut self, element: T) -> Result<(), NotEnoughSpace>

Pushes a new element to the front of the destaque.

( 1 2 -- 3 1 2 )

§Errors

Returns NotEnoughSpace if the destaque is full.

§Examples
let mut q = DestaqueU32::<u8, 3>::default();
q.push_front(1)?;
q.push_front(2)?;
q.push_front(3)?;
assert_eq![q.to_array(), Some([3, 2, 1])];
Source

pub fn push_front_unchecked(&mut self, element: T)

Unchecked version of push_front.

§Panics

Panics if the destaque is full.

Source

pub fn push_front_override(&mut self, element: T) -> bool

Pushes a new element to the front of the destaque, overriding an element from the back if the destaque is full.

Returns true if an element was overridden, and false otherwise.

§Examples
let mut q = DestaqueU32::<_, 3>::from([1, 2]);
assert_eq!(q.push_front_override(3), false);
assert_eq![q.to_array(), Some([3, 1, 2])];
assert_eq!(q.push_front_override(4), true);
assert_eq![q.to_array(), Some([4, 3, 1])];
Source

pub fn push_back(&mut self, element: T) -> Result<(), NotEnoughSpace>

Pushes a new element to the back of the destaque.

This is the habitual enqueue operation for a single-ended queue.

( 1 2 -- 1 2 3 )

§Errors

Returns NotEnoughSpace if the destaque is full.

§Examples
let mut q = DestaqueU32::<u8, 3>::default();
q.push_back(1)?;
q.push_back(2)?;
q.push_back(3)?;
assert_eq![q.to_array(), Some([1, 2, 3])];
Source

pub fn enqueue(&mut self, element: T) -> Result<(), NotEnoughSpace>

Alias of push_back.

This is the habitual enqueue operation for a single-ended queue.

Source

pub fn push_back_unchecked(&mut self, element: T)

Unchecked version of push_back.

§Panics

Panics if the destaque is full.

Source

pub fn push_back_override(&mut self, element: T) -> bool

Pushes a new element to the back of the destaque, overriding the first element if the destaque is full.

Returns true if an element was overridden, and false otherwise.

§Examples
let mut q = DestaqueU32::<_, 3>::from([1, 2]);
assert_eq!(q.push_back_override(3), false);
assert_eq![q.to_array(), Some([1, 2, 3])];
assert_eq!(q.push_back_override(4), true);
assert_eq![q.to_array(), Some([2, 3, 4])];
Source

pub fn pop_front(&mut self) -> Result<T, NotEnoughElements>

Available on crate feature unsafe_ptr or Clone only.

Pops the front element.

This is the habitual dequeue operation for a signle-ended queue.

( 1 2 -- 2 )

§Errors

Returns NotEnoughElements if the queue is empty.

§Examples

let mut q = DestaqueU32::<_, 8>::from([1, 2, 3]);
assert_eq![1, q.pop_front()?];
assert_eq![2, q.pop_front()?];
assert_eq![3, q.pop_front()?];
assert![q.is_empty()];
§Features

It’s depends on T: Clone, unless the unsafe_ptr feature is enabled.

Source

pub fn dequeue(&mut self) -> Result<T, NotEnoughElements>

Available on crate feature unsafe_ptr or Clone only.

Alias of pop_front.

This is the habitual dequeue operation for a single-ended queue.

Source

pub fn pop_back(&mut self) -> Result<T, NotEnoughElements>

Available on crate feature unsafe_ptr or Clone only.

Pops the back element.

( 1 2-- 1 )

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueU32::<_, 8>::from([1, 2, 3]);
assert_eq![3, q.pop_back()?];
assert_eq![2, q.pop_back()?];
assert_eq![1, q.pop_back()?];
assert![q.is_empty()];
§Features

It’s depends on T: Clone, unless the unsafe_ptr feature is enabled.

Source

pub fn peek_back(&self) -> Result<&T, NotEnoughElements>

Returns a shared reference to the back element.

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let q = DestaqueU32::<_, 8>::from([1, 2, 3]);
assert_eq![&3, q.peek_back()?];
Source

pub fn peek_back_mut(&mut self) -> Result<&mut T, NotEnoughElements>

Returns an exclusive reference to the back element.

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueU32::<_, 8>::from([1, 2, 3]);
assert_eq![&mut 3, q.peek_back_mut()?];
Source

pub fn peek_nth_back(&self, nth: u32) -> Result<&T, NotEnoughElements>

Returns a shared reference to the nth back element.

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least nth elements.

§Examples
let q = DestaqueU32::<_, 8>::from([1, 2, 3]);
assert_eq![&1, q.peek_nth_back(2)?];
Source

pub fn peek_nth_back_mut( &mut self, nth: u32, ) -> Result<&mut T, NotEnoughElements>

Returns an exclusive reference to the nth back element.

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least nth elements.

§Examples
let mut q = DestaqueU32::<_, 8>::from([1, 2, 3]);
assert_eq![&mut 1, q.peek_nth_back_mut(2)?];
Source

pub fn peek_front(&self) -> Result<&T, NotEnoughElements>

Returns a shared reference to the front element.

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let q = DestaqueU32::<_, 8>::from([1, 2, 3]);
assert_eq![&1, q.peek_front()?];
Source

pub fn peek_front_mut(&mut self) -> Result<&mut T, NotEnoughElements>

Returns an exclusive reference to the front element.

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueU32::<_, 8>::from([1, 2, 3]);
assert_eq![&mut 1, q.peek_front_mut()?];
Source

pub fn peek_nth_front(&self, nth: u32) -> Result<&T, NotEnoughElements>

Returns a shared reference to the nth front element.

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least nth elements.

§Examples
let q = DestaqueU32::<_, 8>::from([1, 2, 3, 4]);
assert_eq![&3, q.peek_nth_front(2)?];
Source

pub fn peek_nth_front_mut( &mut self, nth: u32, ) -> Result<&mut T, NotEnoughElements>

Returns an exclusive reference to the nth front element.

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least nth elements.

§Examples
let mut q = DestaqueU32::<_, 8>::from([1, 2, 3, 4]);
assert_eq![&mut 3, q.peek_nth_front_mut(2)?];
Source

pub const fn clear(&mut self)

Clears the destaque.

( 1 2 -- )

§Examples
let mut q = DestaqueU32::<_, 8>::from([1, 2, 3, 4]);
q.clear();
assert![q.is_empty()];
Source

pub fn drop_back(&mut self) -> Result<(), NotEnoughElements>

Drops the back element.

( 1 2 -- 1 )

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueU32::<_, 8>::from([1, 2]);
q.drop_back()?;
assert_eq![q.to_array(), Some([1])];
Source

pub fn drop_front(&mut self) -> Result<(), NotEnoughElements>

Drops the front element.

( 1 2 -- 2 )

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueU32::<_, 8>::from([1, 2]);
q.drop_front()?;
assert_eq![q.to_array(), Some([2])];
Source

pub fn drop_n_back(&mut self, nth: u32) -> Result<(), NotEnoughElements>

Drops n elements from the back.

( 1 2 3 4 -- 1 ) for n = 3

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least nth elements.

§Examples
let mut q = DestaqueU32::<_, 8>::from([1, 2, 3, 4]);
q.drop_n_back(3)?;
assert_eq![q.to_array(), Some([1])];
Source

pub fn drop_n_front(&mut self, nth: u32) -> Result<(), NotEnoughElements>

Drops n elements from the front.

( 1 2 3 4 -- 4 ) for n = 3

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least nth elements.

§Examples
let mut q = DestaqueU32::<_, 8>::from([1, 2, 3, 4]);
q.drop_n_front(3)?;
assert_eq![q.to_array(), Some([4])];
Source

pub fn swap_back(&mut self) -> Result<(), NotEnoughElements>

Swaps the last two elements at the back of the destaque.

( 1 2 3 4 -- 1 2 4 3 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 2 elements.

§Examples
let mut q = DestaqueU32::<_, 4>::from([1, 2, 3, 4]);
q.swap_back();
assert_eq![q.to_array(), Some([1, 2, 4, 3])];
Source

pub fn swap_back_unchecked(&mut self)

Unchecked version of swap_back.

§Panics

Panics if the destaque doesn’t contain at least 2 elements.

Source

pub fn swap_front(&mut self) -> Result<(), NotEnoughElements>

Swaps the first two elements at the front of the destaque.

( 1 2 3 4 -- 2 1 3 4 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 2 elements.

§Examples
let mut q = DestaqueU32::<_, 4>::from([1, 2, 3, 4]);
q.swap_front();
assert_eq![q.to_array(), Some([2, 1, 3, 4])];
Source

pub fn swap_front_unchecked(&mut self)

Unchecked version of swap_front.

§Panics

Panics if the destaque doesn’t contain at least 2 elements.

Source

pub fn swap2_back(&mut self) -> Result<(), NotEnoughElements>

Swaps the last two pairs of elements at the back of the destaque.

( 1 2 3 4 5 6 7 8 -- 1 2 3 4 7 8 5 6 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 2 elements.

§Examples
let mut q = DestaqueU32::<_, 16>::from([1, 2, 3, 4, 5, 6, 7, 8]);
q.swap2_back();
assert_eq![q.to_array(), Some([1, 2, 3, 4, 7, 8, 5, 6])];
Source

pub fn swap2_back_unchecked(&mut self)

Unchecked version of swap2_back.

§Panics

Panics if the destaque doesn’t contain at least 2 elements.

Source

pub fn swap2_front(&mut self) -> Result<(), NotEnoughElements>

Swaps the first two pairs of elements at the front of the destaque. ( 1 2 3 4 5 6 7 8 -- 3 4 1 2 5 6 7 8 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 4 elements.

§Examples
let mut q = DestaqueU32::<_, 16>::from([1, 2, 3, 4, 5, 6, 7, 8]);
q.swap2_front();
assert_eq![q.to_array(), Some([3, 4, 1, 2, 5, 6, 7, 8])];
Source

pub fn swap2_front_unchecked(&mut self)

Unchecked version of swap2_back.

§Panics

Panics if the destaque doesn’t contain at least 2 elements.

Source

pub fn swap_ends(&mut self) -> Result<(), NotEnoughElements>

Swaps the front and back elements.

( 1 2 3 4 -- 4 2 3 1 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 2 elements.

§Examples
let mut q = DestaqueU32::<_, 6>::from([1, 2, 3, 4, 5]);
q.swap_ends();
assert_eq![q.to_array(), Some([5, 2, 3, 4, 1])];
Source

pub fn swap2_ends(&mut self) -> Result<(), NotEnoughElements>

Swaps the front and back pairs of elements.

( 1 2 3 4 5 6 7 8 -- 7 8 3 4 5 6 1 2 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 4 elements.

§Examples
let mut q = DestaqueU32::<_, 16>::from([1, 2, 3, 4, 5, 6, 7, 8]);
q.swap2_ends();
assert_eq![q.to_array(), Some([7, 8, 3, 4, 5, 6, 1, 2])];
Source

pub fn rot_right(&mut self)

Rotates all the destaqued elements one place to the right.

( 1 2 3 4 -- 4 1 2 3 )

§Examples
let mut q = DestaqueU32::<i32, 8>::from([2, 3]);
q.push_front(1)?;
q.push_back(4)?;
assert_eq![q.to_array(), Some([1, 2, 3, 4])];
q.rot_right();
assert_eq![q.to_array(), Some([4, 1, 2, 3])];
Source

pub fn rot_right_n(&mut self, nth: u32)

Rotates all the destaqued elements n places to the right.

( 1 2 3 4 -- 2 3 4 1 ) for n = 3

§Examples
let mut q = DestaqueU32::<i32, 8>::from([2, 3]);
q.push_front(1)?;
q.push_back(4)?;
assert_eq![q.to_array(), Some([1, 2, 3, 4])];
q.rot_right_n(3);
assert_eq![q.to_array(), Some([2, 3, 4, 1])];
Source

pub fn rot_left(&mut self)

Rotates all the destaqued elements one place to the left.

( 1 2 3 4 -- 2 3 4 1 )

§Examples
let mut q = DestaqueU32::<i32, 8>::from([2, 3]);
q.push_front(1)?;
q.push_back(4)?;
assert_eq![q.to_array(), Some([1, 2, 3, 4])];
q.rot_left();
assert_eq![q.to_array(), Some([2, 3, 4, 1])];
Source

pub fn rot_left_n(&mut self, nth: u32)

Rotates all the destaqued elements n places to the left.

( 1 2 3 4 -- 4 1 2 3 ) for nth = 3

§Examples
let mut q = DestaqueU32::<i32, 8>::from([2, 3]);
q.push_front(1)?;
q.push_back(4)?;
assert_eq![q.to_array(), Some([1, 2, 3, 4])];
q.rot_left_n(3);
assert_eq![q.to_array(), Some([4, 1, 2, 3])];
Source§

impl<T: Clone, const CAP: usize, S: Storage> Destaque<T, CAP, u32, S>

Source

pub fn make_contiguous(&mut self, element: T) -> &mut [T]

Makes the elements of the destaque contiguous, rearranging the elements so that they are in a single, continuous block starting from the front.

This operation might rearrange the internal representation of the elements to ensure they are contiguous. It clones the default element provided during the destaque’s construction to fill any gaps if necessary.

Returns a mutable slice to the now contiguous elements.

§Examples

let mut q = DestaqueU32::<_, 5>::new(0).unwrap();
q.push_back(1);
q.push_back(2);
q.push_front(5);
assert_eq!(q.as_slices(), (&[5][..], &[1, 2][..]));

assert_eq!(q.make_contiguous(0), &[5, 1, 2]);
assert_eq!(q.as_slices(), (&[5, 1, 2][..], &[][..]));
Source

pub fn to_vec(&self) -> Vec<T>

Available on crate feature alloc only.

Returns the destaqued elements as a vector.

§Examples
let mut q = DestaqueU32::<_, 5>::from([3, 4]);
q.push_front(2)?;
q.push_back(5)?;
q.push_front(1)?;
assert_eq![q.to_vec(), vec![1, 2, 3, 4, 5]];
Source

pub fn to_array<const LEN: usize>(&self) -> Option<[T; LEN]>

Returns some LEN destaqued elements as an array, or None if the destaque is empty, or there are not at least LEN elements.

This is a non alloc alternative method to to_vec.

§Panics

Panics if the new LEN sized array can’t be allocated.

§Examples
let mut q = DestaqueU32::<_, 5>::from([3, 4]);
q.push_front(2)?;
q.push_back(5)?;
q.push_front(1)?;
assert_eq![q.to_array::<5>(), Some([1, 2, 3, 4, 5])];
§Features

Makes use of the unsafe_array feature if enabled.

Source

pub fn dup_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the back element at the back

( 1 2 -- 1 2 2 )

§Errors

Returns NotEnoughElements if the destaque is empty or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueU32::<u8, 4>::from([1, 2, 3]);
q.dup_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 3])];
Source

pub fn dup_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the front element at the front.

( 1 2 -- 1 1 2 )

§Errors

Returns NotEnoughElements if the destaque is empty or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueU32::<u8, 4>::from([1, 2, 3]);
q.dup_front()?;
assert_eq![q.to_array(), Some([1, 1, 2, 3])];
Source

pub fn dup2_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the back pair of elements, at the back.

( 1 2 3 4 -- 1 2 3 4 3 4)

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU32::<u8, 6>::from([1, 2, 3, 4]);
q.dup2_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 4, 3, 4])];
Source

pub fn dup2_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the front pair of elements, at the front.

( 1 2 3 4 -- 1 2 1 2 3 4)

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU32::<u8, 6>::from([1, 2, 3, 4]);
q.dup2_front()?;
assert_eq![q.to_array(), Some([1, 2, 1, 2, 3, 4])];
Source

pub fn over_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the second back element, at the back.

( 1 2 3 4 -- 1 2 3 4 3 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueU32::<u8, 7>::from([1, 2, 3, 4]);
q.over_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 4, 3])];
Source

pub fn over_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the second front element, at the front.

( 1 2 3 4 -- 2 1 2 3 4 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueU32::<u8, 7>::from([1, 2, 3, 4]);
q.over_front()?;
assert_eq![q.to_array(), Some([2, 1, 2, 3, 4])];
Source

pub fn over2_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the second back pair of elements, at the back.

( 1 2 3 4 5 6 7 8 -- 1 2 3 4 5 6 7 8 5 6 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 4 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU32::<u8, 8>::from([1, 2, 3, 4, 5, 6]);
q.over2_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 4, 5, 6, 3, 4])];
Source

pub fn over2_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the second front pair of elements, at the front.

( 1 2 3 4 5 6 7 8 -- 3 4 1 2 3 4 5 6 7 8 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 4 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU32::<u8, 8>::from([1, 2, 3, 4, 5, 6]);
q.over2_front()?;
assert_eq![q.to_array(), Some([3, 4, 1, 2, 3, 4, 5, 6])];
Source

pub fn tuck_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the back element, before the second back element.

( 1 2 3 4 -- 1 2 4 3 4 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it is full.

§Examples

let mut q = DestaqueU32::<u8, 7>::from([1, 2, 3, 4, 5]);
q.tuck_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 5, 4, 5])];
Source

pub fn tuck_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the front element, after the second front element.

( 1 2 3 4 -- 1 2 1 3 4 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueU32::<u8, 7>::from([1, 2, 3, 4, 5]);
q.tuck_front()?;
assert_eq![q.to_array(), Some([1, 2, 1, 3, 4, 5])];
Source

pub fn tuck2_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the back pair of elements, before the second back pair of elements.

( 1 2 3 4 5 6 7 8 -- 1 2 3 4 7 8 5 6 7 8 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 4 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU32::<u8, 7>::from([1, 2, 3, 4, 5]);
q.tuck2_back()?;
assert_eq![q.to_array(), Some([1, 4, 5, 2, 3, 4, 5])];
Source

pub fn tuck2_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the front pair of elements, after the second front pair of elements.

( 1 2 3 4 5 6 7 8 -- 1 2 3 4 1 2 5 6 7 8 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 4 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueU32::<u8, 7>::from([1, 2, 3, 4, 5]);
q.tuck2_front()?;
assert_eq![q.to_array(), Some([1, 2, 3, 4, 1, 2, 5])];
Source§

impl<T, const CAP: usize, S: Storage> Destaque<T, CAP, u32, S>

Source

pub const fn iter(&self) -> DestaqueIter<'_, T, CAP, u32, S>

Returns an iterator.

Source

pub fn extend_back<I>(&mut self, iterator: I) -> Result<(), NotEnoughSpace>
where I: IntoIterator<Item = T>,

Extends the back of the destaque from an iterator.

( 1 2 -- 1 2 3 4 5 6) for [3 4 5 6]

§Errors

Returns NotEnoughSpace if the destaque becomes full before the iterator finishes.

§Examples
let mut q = DestaqueU32::<_, 6>::from([1, 2, 3]);
q.extend_back([4, 5, 6, 7, 8]);
assert_eq![q.to_array(), Some([1, 2, 3, 4, 5, 6])];
Source

pub fn extend_back_override<I>(&mut self, iterator: I) -> bool
where I: IntoIterator<Item = T>,

Extends the back of the destaque from an iterator, overriding elements from the front if the destaque is full.

( 1 2 3 -- 3 4 5 6) for [4 5 6] and CAP = 4

§Examples
let mut q = DestaqueU32::<_, 4>::from([1, 2, 3]);
assert_eq![q.extend_back_override([4, 5, 6]), true];
assert_eq![q.to_array(), Some([3, 4, 5, 6])];
Source

pub fn extend_front<I>(&mut self, iterator: I) -> Result<(), NotEnoughSpace>
where I: IntoIterator<Item = T>,

Extends the front of the destaque from an iterator.

( 1 2 -- 6 5 4 3 1 2 ) for [3 4 5 6]

§Errors

Returns NotEnoughSpace if the destaque becomes full before the iterator finishes.

§Examples
let mut q = DestaqueU32::<_, 6>::from([1, 2, 3]);
q.extend_front([4, 5, 6, 7, 8]);
assert_eq![q.to_array(), Some([6, 5, 4, 1, 2, 3])];
Source

pub fn extend_front_override<I>(&mut self, iterator: I) -> bool
where I: IntoIterator<Item = T>,

Extends the front of the destaque from an iterator, overriding elements from the back if the destaque is full.

( 1 2 3 -- 6 5 4 1) for [4 5 6] and CAP = 4

§Examples
let mut q = DestaqueU32::<_, 4>::from([1, 2, 3]);
assert_eq![q.extend_front_override([4, 5, 6]), true];
assert_eq![q.to_array(), Some([6, 5, 4, 1])];
Source§

impl<T: PartialEq, const CAP: usize, S: Storage> Destaque<T, CAP, u32, S>

Source

pub fn contains(&self, element: &T) -> bool

Returns true if the destaque contains element.

§Examples
let q = DestaqueU32::<_, 6>::from([5, 78, 42, 33, 9]);

assert![q.contains(&9)];
assert![!q.contains(&8)];
Source§

impl<T: Clone, const CAP: usize> Destaque<T, CAP, usize, Bare>

§Methods for DestaqueUsize



This impl block contains no items.
Source§

impl<T: Clone, const CAP: usize> Destaque<T, CAP, usize, Bare>

Source

pub fn new(element: T) -> Result<Self, MismatchedCapacity>

Returns an empty destaque, allocated in the stack, cloning element to fill the remaining free data.

§Errors

Returns MismatchedCapacity if CAP > usize::MAX or if CAP > isize::MAX / size_of::<T>().

§Examples
let q = DestaqueUsize::<_, 16>::new(0).unwrap();
Source§

impl<T: Copy, const CAP: usize> Destaque<T, CAP, usize, Bare>

Source

pub const fn new_copied(element: T) -> Result<Self, MismatchedCapacity>

Returns an empty destaque, allocated in the stack, copying element to fill the remaining free data, in compile-time.

§Errors

Returns MismatchedCapacity if CAP > usize::MAX or if CAP > isize::MAX / size_of::<T>().

§Examples
const S: DestaqueUsize<i32, 16> = unwrap![ok DestaqueUsize::new_copied(0)];
Source§

impl<T: Clone, const CAP: usize> Destaque<T, CAP, usize, Boxed>

Source

pub fn new(element: T) -> Self

Available on crate feature alloc only.

Returns an empty destaque, allocated in the heap, cloning element to fill the remaining free data.

§Examples
let q = DestaqueUsize::<_, 3, Boxed>::new(0);
Source§

impl<T, const CAP: usize> Destaque<T, CAP, usize, Bare>

Source

pub const fn from_array_copy(arr: [T; CAP]) -> Destaque<T, CAP, usize, Bare>

Converts an array into a full destaque.

§Examples
let q = DestaqueUsize::<_, 3>::from_array([1, 2, 3]);
Source§

impl<T, const CAP: usize, S: Storage> Destaque<T, CAP, usize, S>

Source

pub fn from_array(arr: [T; CAP]) -> Destaque<T, CAP, usize, S>

Converts an array into a full destaque.

§Examples
let q = DestaqueUsize::<_, 3>::from_array([1, 2, 3]);
Source

pub const fn len(&self) -> usize

Returns the number of destaqued elements.

Source

pub const fn is_empty(&self) -> bool

Returns true if the destaque is empty.

§Examples
let q = DestaqueUsize::<i32, 8>::default();
assert![q.is_empty()];
Source

pub const fn is_full(&self) -> bool

Returns true if the destaque is full.

§Examples
let q = DestaqueUsize::<_, 3>::from([1, 2, 3]);
assert![q.is_full()];
Source

pub const fn capacity(&self) -> usize

Returns the destaque’s total capacity.

§Examples
let q = DestaqueUsize::<i32, 3>::default();
assert_eq![3, q.capacity()];
Source

pub const fn remaining_capacity(&self) -> usize

Returns the destaque’s remaining capacity.

§Examples
let mut q = DestaqueUsize::<i32, 3>::default();
assert_eq![3, q.remaining_capacity()];
q.push_back(1)?;
assert_eq![2, q.remaining_capacity()];
Source

pub fn as_slices(&self) -> (&[T], &[T])

Returns the destaque as pair of shared slices, which contain, in order, the contents of the destaque.

§Examples
let q = DestaqueUsize::<_, 3>::from([1, 2, 3]);
assert_eq![q.as_slices(), (&[1, 2, 3][..], &[][..])];
Source

pub const fn is_contiguous(&self) -> bool

Returns true if the destaque is contiguous.

§Examples
let mut q = DestaqueUsize::<_, 3>::from([1, 2, 3]);
assert_eq![q.as_slices(), (&[1, 2, 3][..], &[][..])];
assert![q.is_contiguous()];
q.pop_back()?;
q.push_front(4)?;
assert![!q.is_contiguous()];
assert_eq![q.as_slices(), (&[4][..], &[1, 2][..])];
Source

pub fn push_front(&mut self, element: T) -> Result<(), NotEnoughSpace>

Pushes a new element to the front of the destaque.

( 1 2 -- 3 1 2 )

§Errors

Returns NotEnoughSpace if the destaque is full.

§Examples
let mut q = DestaqueUsize::<u8, 3>::default();
q.push_front(1)?;
q.push_front(2)?;
q.push_front(3)?;
assert_eq![q.to_array(), Some([3, 2, 1])];
Source

pub fn push_front_unchecked(&mut self, element: T)

Unchecked version of push_front.

§Panics

Panics if the destaque is full.

Source

pub fn push_front_override(&mut self, element: T) -> bool

Pushes a new element to the front of the destaque, overriding an element from the back if the destaque is full.

Returns true if an element was overridden, and false otherwise.

§Examples
let mut q = DestaqueUsize::<_, 3>::from([1, 2]);
assert_eq!(q.push_front_override(3), false);
assert_eq![q.to_array(), Some([3, 1, 2])];
assert_eq!(q.push_front_override(4), true);
assert_eq![q.to_array(), Some([4, 3, 1])];
Source

pub fn push_back(&mut self, element: T) -> Result<(), NotEnoughSpace>

Pushes a new element to the back of the destaque.

This is the habitual enqueue operation for a single-ended queue.

( 1 2 -- 1 2 3 )

§Errors

Returns NotEnoughSpace if the destaque is full.

§Examples
let mut q = DestaqueUsize::<u8, 3>::default();
q.push_back(1)?;
q.push_back(2)?;
q.push_back(3)?;
assert_eq![q.to_array(), Some([1, 2, 3])];
Source

pub fn enqueue(&mut self, element: T) -> Result<(), NotEnoughSpace>

Alias of push_back.

This is the habitual enqueue operation for a single-ended queue.

Source

pub fn push_back_unchecked(&mut self, element: T)

Unchecked version of push_back.

§Panics

Panics if the destaque is full.

Source

pub fn push_back_override(&mut self, element: T) -> bool

Pushes a new element to the back of the destaque, overriding the first element if the destaque is full.

Returns true if an element was overridden, and false otherwise.

§Examples
let mut q = DestaqueUsize::<_, 3>::from([1, 2]);
assert_eq!(q.push_back_override(3), false);
assert_eq![q.to_array(), Some([1, 2, 3])];
assert_eq!(q.push_back_override(4), true);
assert_eq![q.to_array(), Some([2, 3, 4])];
Source

pub fn pop_front(&mut self) -> Result<T, NotEnoughElements>

Available on crate feature unsafe_ptr or Clone only.

Pops the front element.

This is the habitual dequeue operation for a signle-ended queue.

( 1 2 -- 2 )

§Errors

Returns NotEnoughElements if the queue is empty.

§Examples

let mut q = DestaqueUsize::<_, 8>::from([1, 2, 3]);
assert_eq![1, q.pop_front()?];
assert_eq![2, q.pop_front()?];
assert_eq![3, q.pop_front()?];
assert![q.is_empty()];
§Features

It’s depends on T: Clone, unless the unsafe_ptr feature is enabled.

Source

pub fn dequeue(&mut self) -> Result<T, NotEnoughElements>

Available on crate feature unsafe_ptr or Clone only.

Alias of pop_front.

This is the habitual dequeue operation for a single-ended queue.

Source

pub fn pop_back(&mut self) -> Result<T, NotEnoughElements>

Available on crate feature unsafe_ptr or Clone only.

Pops the back element.

( 1 2-- 1 )

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueUsize::<_, 8>::from([1, 2, 3]);
assert_eq![3, q.pop_back()?];
assert_eq![2, q.pop_back()?];
assert_eq![1, q.pop_back()?];
assert![q.is_empty()];
§Features

It’s depends on T: Clone, unless the unsafe_ptr feature is enabled.

Source

pub fn peek_back(&self) -> Result<&T, NotEnoughElements>

Returns a shared reference to the back element.

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let q = DestaqueUsize::<_, 8>::from([1, 2, 3]);
assert_eq![&3, q.peek_back()?];
Source

pub fn peek_back_mut(&mut self) -> Result<&mut T, NotEnoughElements>

Returns an exclusive reference to the back element.

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueUsize::<_, 8>::from([1, 2, 3]);
assert_eq![&mut 3, q.peek_back_mut()?];
Source

pub fn peek_nth_back(&self, nth: usize) -> Result<&T, NotEnoughElements>

Returns a shared reference to the nth back element.

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least nth elements.

§Examples
let q = DestaqueUsize::<_, 8>::from([1, 2, 3]);
assert_eq![&1, q.peek_nth_back(2)?];
Source

pub fn peek_nth_back_mut( &mut self, nth: usize, ) -> Result<&mut T, NotEnoughElements>

Returns an exclusive reference to the nth back element.

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least nth elements.

§Examples
let mut q = DestaqueUsize::<_, 8>::from([1, 2, 3]);
assert_eq![&mut 1, q.peek_nth_back_mut(2)?];
Source

pub fn peek_front(&self) -> Result<&T, NotEnoughElements>

Returns a shared reference to the front element.

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let q = DestaqueUsize::<_, 8>::from([1, 2, 3]);
assert_eq![&1, q.peek_front()?];
Source

pub fn peek_front_mut(&mut self) -> Result<&mut T, NotEnoughElements>

Returns an exclusive reference to the front element.

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueUsize::<_, 8>::from([1, 2, 3]);
assert_eq![&mut 1, q.peek_front_mut()?];
Source

pub fn peek_nth_front(&self, nth: usize) -> Result<&T, NotEnoughElements>

Returns a shared reference to the nth front element.

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least nth elements.

§Examples
let q = DestaqueUsize::<_, 8>::from([1, 2, 3, 4]);
assert_eq![&3, q.peek_nth_front(2)?];
Source

pub fn peek_nth_front_mut( &mut self, nth: usize, ) -> Result<&mut T, NotEnoughElements>

Returns an exclusive reference to the nth front element.

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least nth elements.

§Examples
let mut q = DestaqueUsize::<_, 8>::from([1, 2, 3, 4]);
assert_eq![&mut 3, q.peek_nth_front_mut(2)?];
Source

pub const fn clear(&mut self)

Clears the destaque.

( 1 2 -- )

§Examples
let mut q = DestaqueUsize::<_, 8>::from([1, 2, 3, 4]);
q.clear();
assert![q.is_empty()];
Source

pub fn drop_back(&mut self) -> Result<(), NotEnoughElements>

Drops the back element.

( 1 2 -- 1 )

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueUsize::<_, 8>::from([1, 2]);
q.drop_back()?;
assert_eq![q.to_array(), Some([1])];
Source

pub fn drop_front(&mut self) -> Result<(), NotEnoughElements>

Drops the front element.

( 1 2 -- 2 )

§Errors

Returns NotEnoughElements if the destaque is empty.

§Examples
let mut q = DestaqueUsize::<_, 8>::from([1, 2]);
q.drop_front()?;
assert_eq![q.to_array(), Some([2])];
Source

pub fn drop_n_back(&mut self, nth: usize) -> Result<(), NotEnoughElements>

Drops n elements from the back.

( 1 2 3 4 -- 1 ) for n = 3

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least nth elements.

§Examples
let mut q = DestaqueUsize::<_, 8>::from([1, 2, 3, 4]);
q.drop_n_back(3)?;
assert_eq![q.to_array(), Some([1])];
Source

pub fn drop_n_front(&mut self, nth: usize) -> Result<(), NotEnoughElements>

Drops n elements from the front.

( 1 2 3 4 -- 4 ) for n = 3

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least nth elements.

§Examples
let mut q = DestaqueUsize::<_, 8>::from([1, 2, 3, 4]);
q.drop_n_front(3)?;
assert_eq![q.to_array(), Some([4])];
Source

pub fn swap_back(&mut self) -> Result<(), NotEnoughElements>

Swaps the last two elements at the back of the destaque.

( 1 2 3 4 -- 1 2 4 3 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 2 elements.

§Examples
let mut q = DestaqueUsize::<_, 4>::from([1, 2, 3, 4]);
q.swap_back();
assert_eq![q.to_array(), Some([1, 2, 4, 3])];
Source

pub fn swap_back_unchecked(&mut self)

Unchecked version of swap_back.

§Panics

Panics if the destaque doesn’t contain at least 2 elements.

Source

pub fn swap_front(&mut self) -> Result<(), NotEnoughElements>

Swaps the first two elements at the front of the destaque.

( 1 2 3 4 -- 2 1 3 4 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 2 elements.

§Examples
let mut q = DestaqueUsize::<_, 4>::from([1, 2, 3, 4]);
q.swap_front();
assert_eq![q.to_array(), Some([2, 1, 3, 4])];
Source

pub fn swap_front_unchecked(&mut self)

Unchecked version of swap_front.

§Panics

Panics if the destaque doesn’t contain at least 2 elements.

Source

pub fn swap2_back(&mut self) -> Result<(), NotEnoughElements>

Swaps the last two pairs of elements at the back of the destaque.

( 1 2 3 4 5 6 7 8 -- 1 2 3 4 7 8 5 6 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 2 elements.

§Examples
let mut q = DestaqueUsize::<_, 16>::from([1, 2, 3, 4, 5, 6, 7, 8]);
q.swap2_back();
assert_eq![q.to_array(), Some([1, 2, 3, 4, 7, 8, 5, 6])];
Source

pub fn swap2_back_unchecked(&mut self)

Unchecked version of swap2_back.

§Panics

Panics if the destaque doesn’t contain at least 2 elements.

Source

pub fn swap2_front(&mut self) -> Result<(), NotEnoughElements>

Swaps the first two pairs of elements at the front of the destaque. ( 1 2 3 4 5 6 7 8 -- 3 4 1 2 5 6 7 8 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 4 elements.

§Examples
let mut q = DestaqueUsize::<_, 16>::from([1, 2, 3, 4, 5, 6, 7, 8]);
q.swap2_front();
assert_eq![q.to_array(), Some([3, 4, 1, 2, 5, 6, 7, 8])];
Source

pub fn swap2_front_unchecked(&mut self)

Unchecked version of swap2_back.

§Panics

Panics if the destaque doesn’t contain at least 2 elements.

Source

pub fn swap_ends(&mut self) -> Result<(), NotEnoughElements>

Swaps the front and back elements.

( 1 2 3 4 -- 4 2 3 1 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 2 elements.

§Examples
let mut q = DestaqueUsize::<_, 6>::from([1, 2, 3, 4, 5]);
q.swap_ends();
assert_eq![q.to_array(), Some([5, 2, 3, 4, 1])];
Source

pub fn swap2_ends(&mut self) -> Result<(), NotEnoughElements>

Swaps the front and back pairs of elements.

( 1 2 3 4 5 6 7 8 -- 7 8 3 4 5 6 1 2 )

§Errors

Returns NotEnoughElements if the destaque doesn’t contain at least 4 elements.

§Examples
let mut q = DestaqueUsize::<_, 16>::from([1, 2, 3, 4, 5, 6, 7, 8]);
q.swap2_ends();
assert_eq![q.to_array(), Some([7, 8, 3, 4, 5, 6, 1, 2])];
Source

pub fn rot_right(&mut self)

Rotates all the destaqued elements one place to the right.

( 1 2 3 4 -- 4 1 2 3 )

§Examples
let mut q = DestaqueUsize::<i32, 8>::from([2, 3]);
q.push_front(1)?;
q.push_back(4)?;
assert_eq![q.to_array(), Some([1, 2, 3, 4])];
q.rot_right();
assert_eq![q.to_array(), Some([4, 1, 2, 3])];
Source

pub fn rot_right_n(&mut self, nth: usize)

Rotates all the destaqued elements n places to the right.

( 1 2 3 4 -- 2 3 4 1 ) for n = 3

§Examples
let mut q = DestaqueUsize::<i32, 8>::from([2, 3]);
q.push_front(1)?;
q.push_back(4)?;
assert_eq![q.to_array(), Some([1, 2, 3, 4])];
q.rot_right_n(3);
assert_eq![q.to_array(), Some([2, 3, 4, 1])];
Source

pub fn rot_left(&mut self)

Rotates all the destaqued elements one place to the left.

( 1 2 3 4 -- 2 3 4 1 )

§Examples
let mut q = DestaqueUsize::<i32, 8>::from([2, 3]);
q.push_front(1)?;
q.push_back(4)?;
assert_eq![q.to_array(), Some([1, 2, 3, 4])];
q.rot_left();
assert_eq![q.to_array(), Some([2, 3, 4, 1])];
Source

pub fn rot_left_n(&mut self, nth: usize)

Rotates all the destaqued elements n places to the left.

( 1 2 3 4 -- 4 1 2 3 ) for nth = 3

§Examples
let mut q = DestaqueUsize::<i32, 8>::from([2, 3]);
q.push_front(1)?;
q.push_back(4)?;
assert_eq![q.to_array(), Some([1, 2, 3, 4])];
q.rot_left_n(3);
assert_eq![q.to_array(), Some([4, 1, 2, 3])];
Source§

impl<T: Clone, const CAP: usize, S: Storage> Destaque<T, CAP, usize, S>

Source

pub fn make_contiguous(&mut self, element: T) -> &mut [T]

Makes the elements of the destaque contiguous, rearranging the elements so that they are in a single, continuous block starting from the front.

This operation might rearrange the internal representation of the elements to ensure they are contiguous. It clones the default element provided during the destaque’s construction to fill any gaps if necessary.

Returns a mutable slice to the now contiguous elements.

§Examples

let mut q = DestaqueUsize::<_, 5>::new(0).unwrap();
q.push_back(1);
q.push_back(2);
q.push_front(5);
assert_eq!(q.as_slices(), (&[5][..], &[1, 2][..]));

assert_eq!(q.make_contiguous(0), &[5, 1, 2]);
assert_eq!(q.as_slices(), (&[5, 1, 2][..], &[][..]));
Source

pub fn to_vec(&self) -> Vec<T>

Available on crate feature alloc only.

Returns the destaqued elements as a vector.

§Examples
let mut q = DestaqueUsize::<_, 5>::from([3, 4]);
q.push_front(2)?;
q.push_back(5)?;
q.push_front(1)?;
assert_eq![q.to_vec(), vec![1, 2, 3, 4, 5]];
Source

pub fn to_array<const LEN: usize>(&self) -> Option<[T; LEN]>

Returns some LEN destaqued elements as an array, or None if the destaque is empty, or there are not at least LEN elements.

This is a non alloc alternative method to to_vec.

§Panics

Panics if the new LEN sized array can’t be allocated.

§Examples
let mut q = DestaqueUsize::<_, 5>::from([3, 4]);
q.push_front(2)?;
q.push_back(5)?;
q.push_front(1)?;
assert_eq![q.to_array::<5>(), Some([1, 2, 3, 4, 5])];
§Features

Makes use of the unsafe_array feature if enabled.

Source

pub fn dup_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the back element at the back

( 1 2 -- 1 2 2 )

§Errors

Returns NotEnoughElements if the destaque is empty or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueUsize::<u8, 4>::from([1, 2, 3]);
q.dup_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 3])];
Source

pub fn dup_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the front element at the front.

( 1 2 -- 1 1 2 )

§Errors

Returns NotEnoughElements if the destaque is empty or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueUsize::<u8, 4>::from([1, 2, 3]);
q.dup_front()?;
assert_eq![q.to_array(), Some([1, 1, 2, 3])];
Source

pub fn dup2_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the back pair of elements, at the back.

( 1 2 3 4 -- 1 2 3 4 3 4)

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueUsize::<u8, 6>::from([1, 2, 3, 4]);
q.dup2_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 4, 3, 4])];
Source

pub fn dup2_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the front pair of elements, at the front.

( 1 2 3 4 -- 1 2 1 2 3 4)

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueUsize::<u8, 6>::from([1, 2, 3, 4]);
q.dup2_front()?;
assert_eq![q.to_array(), Some([1, 2, 1, 2, 3, 4])];
Source

pub fn over_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the second back element, at the back.

( 1 2 3 4 -- 1 2 3 4 3 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueUsize::<u8, 7>::from([1, 2, 3, 4]);
q.over_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 4, 3])];
Source

pub fn over_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the second front element, at the front.

( 1 2 3 4 -- 2 1 2 3 4 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueUsize::<u8, 7>::from([1, 2, 3, 4]);
q.over_front()?;
assert_eq![q.to_array(), Some([2, 1, 2, 3, 4])];
Source

pub fn over2_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the second back pair of elements, at the back.

( 1 2 3 4 5 6 7 8 -- 1 2 3 4 5 6 7 8 5 6 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 4 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueUsize::<u8, 8>::from([1, 2, 3, 4, 5, 6]);
q.over2_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 4, 5, 6, 3, 4])];
Source

pub fn over2_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the second front pair of elements, at the front.

( 1 2 3 4 5 6 7 8 -- 3 4 1 2 3 4 5 6 7 8 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 4 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueUsize::<u8, 8>::from([1, 2, 3, 4, 5, 6]);
q.over2_front()?;
assert_eq![q.to_array(), Some([3, 4, 1, 2, 3, 4, 5, 6])];
Source

pub fn tuck_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the back element, before the second back element.

( 1 2 3 4 -- 1 2 4 3 4 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it is full.

§Examples

let mut q = DestaqueUsize::<u8, 7>::from([1, 2, 3, 4, 5]);
q.tuck_back()?;
assert_eq![q.to_array(), Some([1, 2, 3, 5, 4, 5])];
Source

pub fn tuck_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the front element, after the second front element.

( 1 2 3 4 -- 1 2 1 3 4 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 2 elements, or NotEnoughSpace if it is full.

§Examples
let mut q = DestaqueUsize::<u8, 7>::from([1, 2, 3, 4, 5]);
q.tuck_front()?;
assert_eq![q.to_array(), Some([1, 2, 1, 3, 4, 5])];
Source

pub fn tuck2_back(&mut self) -> Result<(), DataNotEnough>

Duplicates the back pair of elements, before the second back pair of elements.

( 1 2 3 4 5 6 7 8 -- 1 2 3 4 7 8 5 6 7 8 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 4 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueUsize::<u8, 7>::from([1, 2, 3, 4, 5]);
q.tuck2_back()?;
assert_eq![q.to_array(), Some([1, 4, 5, 2, 3, 4, 5])];
Source

pub fn tuck2_front(&mut self) -> Result<(), DataNotEnough>

Duplicates the front pair of elements, after the second front pair of elements.

( 1 2 3 4 5 6 7 8 -- 1 2 3 4 1 2 5 6 7 8 )

§Errors

Returns NotEnoughElements if the destaque doesn’t have at least 4 elements, or NotEnoughSpace if it doesn’t have space for 2 additional elements.

§Examples
let mut q = DestaqueUsize::<u8, 7>::from([1, 2, 3, 4, 5]);
q.tuck2_front()?;
assert_eq![q.to_array(), Some([1, 2, 3, 4, 1, 2, 5])];
Source§

impl<T, const CAP: usize, S: Storage> Destaque<T, CAP, usize, S>

Source

pub const fn iter(&self) -> DestaqueIter<'_, T, CAP, usize, S>

Returns an iterator.

Source

pub fn extend_back<I>(&mut self, iterator: I) -> Result<(), NotEnoughSpace>
where I: IntoIterator<Item = T>,

Extends the back of the destaque from an iterator.

( 1 2 -- 1 2 3 4 5 6) for [3 4 5 6]

§Errors

Returns NotEnoughSpace if the destaque becomes full before the iterator finishes.

§Examples
let mut q = DestaqueUsize::<_, 6>::from([1, 2, 3]);
q.extend_back([4, 5, 6, 7, 8]);
assert_eq![q.to_array(), Some([1, 2, 3, 4, 5, 6])];
Source

pub fn extend_back_override<I>(&mut self, iterator: I) -> bool
where I: IntoIterator<Item = T>,

Extends the back of the destaque from an iterator, overriding elements from the front if the destaque is full.

( 1 2 3 -- 3 4 5 6) for [4 5 6] and CAP = 4

§Examples
let mut q = DestaqueUsize::<_, 4>::from([1, 2, 3]);
assert_eq![q.extend_back_override([4, 5, 6]), true];
assert_eq![q.to_array(), Some([3, 4, 5, 6])];
Source

pub fn extend_front<I>(&mut self, iterator: I) -> Result<(), NotEnoughSpace>
where I: IntoIterator<Item = T>,

Extends the front of the destaque from an iterator.

( 1 2 -- 6 5 4 3 1 2 ) for [3 4 5 6]

§Errors

Returns NotEnoughSpace if the destaque becomes full before the iterator finishes.

§Examples
let mut q = DestaqueUsize::<_, 6>::from([1, 2, 3]);
q.extend_front([4, 5, 6, 7, 8]);
assert_eq![q.to_array(), Some([6, 5, 4, 1, 2, 3])];
Source

pub fn extend_front_override<I>(&mut self, iterator: I) -> bool
where I: IntoIterator<Item = T>,

Extends the front of the destaque from an iterator, overriding elements from the back if the destaque is full.

( 1 2 3 -- 6 5 4 1) for [4 5 6] and CAP = 4

§Examples
let mut q = DestaqueUsize::<_, 4>::from([1, 2, 3]);
assert_eq![q.extend_front_override([4, 5, 6]), true];
assert_eq![q.to_array(), Some([6, 5, 4, 1])];
Source§

impl<T: PartialEq, const CAP: usize, S: Storage> Destaque<T, CAP, usize, S>

Source

pub fn contains(&self, element: &T) -> bool

Returns true if the destaque contains element.

§Examples
let q = DestaqueUsize::<_, 6>::from([5, 78, 42, 33, 9]);

assert![q.contains(&9)];
assert![!q.contains(&8)];

Trait Implementations§

Source§

impl<T, const CAP: usize, IDX, S: Storage> Archive for Destaque<T, CAP, IDX, S>
where Array<T, CAP, S>: Archive, IDX: Archive,

Source§

type Archived = ArchivedDestaque<T, CAP, IDX, S>

The archived representation of this type. Read more
Source§

type Resolver = DestaqueResolver<T, CAP, IDX, S>

The resolver for this type. It must contain all the additional information from serializing needed to make the archived type from the normal type.
Source§

fn resolve(&self, resolver: Self::Resolver, out: Place<Self::Archived>)

Creates the archived version of this value at the given position and writes it to the given output. Read more
§

const COPY_OPTIMIZATION: CopyOptimization<Self> = _

An optimization flag that allows the bytes of this type to be copied directly to a writer instead of calling serialize. Read more
Source§

impl<T: Clone, const CAP: usize, IDX: Clone, S: Storage> Clone for Destaque<T, CAP, IDX, S>
where S::Stored<[T; CAP]>: Clone,

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: ConstDefault, const CAP: usize, IDX: ConstDefault> ConstDefault for Destaque<T, CAP, IDX, Bare>

Source§

const DEFAULT: Self

Returns an empty stack, allocated in the stack, using the default value to fill the remaining free data.

Source§

impl<T, const LEN: usize, S: Storage> DataCollection for Destaque<T, LEN, u16, S>

Source§

type Element = T

The element type of the collection.
Source§

fn collection_capacity(&self) -> Result<usize, NotAvailable>

Returns the reserved capacity for elements in the collection.
Source§

fn collection_len(&self) -> Result<usize, NotAvailable>

Returns the current number of elements in the collection.
Source§

fn collection_is_empty(&self) -> Result<bool, NotAvailable>

Returns true if the collection is empty, false if it’s not.
Source§

fn collection_is_full(&self) -> Result<bool, NotAvailable>

Returns true if the collection is full, false if it’s not.
Source§

fn collection_contains( &self, element: Self::Element, ) -> Result<bool, NotAvailable>
where T: PartialEq,

Returns true if the collection contains the given element.
Source§

fn collection_count( &self, element: &Self::Element, ) -> Result<usize, NotAvailable>
where T: PartialEq,

Counts the number of times a given element appears in the collection.
Source§

impl<T, const LEN: usize, S: Storage> DataCollection for Destaque<T, LEN, u32, S>

Source§

type Element = T

The element type of the collection.
Source§

fn collection_capacity(&self) -> Result<usize, NotAvailable>

Returns the reserved capacity for elements in the collection.
Source§

fn collection_len(&self) -> Result<usize, NotAvailable>

Returns the current number of elements in the collection.
Source§

fn collection_is_empty(&self) -> Result<bool, NotAvailable>

Returns true if the collection is empty, false if it’s not.
Source§

fn collection_is_full(&self) -> Result<bool, NotAvailable>

Returns true if the collection is full, false if it’s not.
Source§

fn collection_contains( &self, element: Self::Element, ) -> Result<bool, NotAvailable>
where T: PartialEq,

Returns true if the collection contains the given element.
Source§

fn collection_count( &self, element: &Self::Element, ) -> Result<usize, NotAvailable>
where T: PartialEq,

Counts the number of times a given element appears in the collection.
Source§

impl<T, const LEN: usize, S: Storage> DataCollection for Destaque<T, LEN, u8, S>

Source§

type Element = T

The element type of the collection.
Source§

fn collection_capacity(&self) -> Result<usize, NotAvailable>

Returns the reserved capacity for elements in the collection.
Source§

fn collection_len(&self) -> Result<usize, NotAvailable>

Returns the current number of elements in the collection.
Source§

fn collection_is_empty(&self) -> Result<bool, NotAvailable>

Returns true if the collection is empty, false if it’s not.
Source§

fn collection_is_full(&self) -> Result<bool, NotAvailable>

Returns true if the collection is full, false if it’s not.
Source§

fn collection_contains( &self, element: Self::Element, ) -> Result<bool, NotAvailable>
where T: PartialEq,

Returns true if the collection contains the given element.
Source§

fn collection_count( &self, element: &Self::Element, ) -> Result<usize, NotAvailable>
where T: PartialEq,

Counts the number of times a given element appears in the collection.
Source§

impl<T, const LEN: usize, S: Storage> DataCollection for Destaque<T, LEN, usize, S>

Source§

type Element = T

The element type of the collection.
Source§

fn collection_capacity(&self) -> Result<usize, NotAvailable>

Returns the reserved capacity for elements in the collection.
Source§

fn collection_len(&self) -> Result<usize, NotAvailable>

Returns the current number of elements in the collection.
Source§

fn collection_is_empty(&self) -> Result<bool, NotAvailable>

Returns true if the collection is empty, false if it’s not.
Source§

fn collection_is_full(&self) -> Result<bool, NotAvailable>

Returns true if the collection is full, false if it’s not.
Source§

fn collection_contains( &self, element: Self::Element, ) -> Result<bool, NotAvailable>
where T: PartialEq,

Returns true if the collection contains the given element.
Source§

fn collection_count( &self, element: &Self::Element, ) -> Result<usize, NotAvailable>
where T: PartialEq,

Counts the number of times a given element appears in the collection.
Source§

impl<T, const CAP: usize, S: Storage> DataDeque for Destaque<T, CAP, u16, S>

Source§

fn queue_pop_back( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the back of the queue. Read more
Source§

fn queue_push_front( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the front of the queue. Read more
Source§

fn queue_pop_front( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the front of the queue (calls queue_pop). Read more
Source§

fn queue_push_back( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Remove an element from the back of the queue (calls queue_push). Read more
Source§

impl<T, const CAP: usize, S: Storage> DataDeque for Destaque<T, CAP, u32, S>

Source§

fn queue_pop_back( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the back of the queue. Read more
Source§

fn queue_push_front( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the front of the queue. Read more
Source§

fn queue_pop_front( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the front of the queue (calls queue_pop). Read more
Source§

fn queue_push_back( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Remove an element from the back of the queue (calls queue_push). Read more
Source§

impl<T, const CAP: usize, S: Storage> DataDeque for Destaque<T, CAP, u8, S>

Source§

fn queue_pop_back( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the back of the queue. Read more
Source§

fn queue_push_front( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the front of the queue. Read more
Source§

fn queue_pop_front( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the front of the queue (calls queue_pop). Read more
Source§

fn queue_push_back( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Remove an element from the back of the queue (calls queue_push). Read more
Source§

impl<T, const CAP: usize, S: Storage> DataDeque for Destaque<T, CAP, usize, S>

Source§

fn queue_pop_back( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the back of the queue. Read more
Source§

fn queue_push_front( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the front of the queue. Read more
Source§

fn queue_pop_front( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the front of the queue (calls queue_pop). Read more
Source§

fn queue_push_back( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Remove an element from the back of the queue (calls queue_push). Read more
Source§

impl<T, const CAP: usize, S: Storage> DataDesta for Destaque<T, CAP, u16, S>

Source§

fn stack_pop_front( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the front of the stack.
Source§

fn stack_push_front( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the front of the stack.
Source§

fn stack_pop_back( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the back of the stack (calls DataStack::stack_pop).
Source§

fn stack_push_back( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Remove an element from the back of the stack (calls DataStack::stack_push).
Source§

impl<T, const CAP: usize, S: Storage> DataDesta for Destaque<T, CAP, u32, S>

Source§

fn stack_pop_front( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the front of the stack.
Source§

fn stack_push_front( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the front of the stack.
Source§

fn stack_pop_back( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the back of the stack (calls DataStack::stack_pop).
Source§

fn stack_push_back( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Remove an element from the back of the stack (calls DataStack::stack_push).
Source§

impl<T, const CAP: usize, S: Storage> DataDesta for Destaque<T, CAP, u8, S>

Source§

fn stack_pop_front( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the front of the stack.
Source§

fn stack_push_front( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the front of the stack.
Source§

fn stack_pop_back( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the back of the stack (calls DataStack::stack_pop).
Source§

fn stack_push_back( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Remove an element from the back of the stack (calls DataStack::stack_push).
Source§

impl<T, const CAP: usize, S: Storage> DataDesta for Destaque<T, CAP, usize, S>

Source§

fn stack_pop_front( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the front of the stack.
Source§

fn stack_push_front( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the front of the stack.
Source§

fn stack_pop_back( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the back of the stack (calls DataStack::stack_pop).
Source§

fn stack_push_back( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Remove an element from the back of the stack (calls DataStack::stack_push).
Source§

impl<T, const CAP: usize, S: Storage> DataQueue for Destaque<T, CAP, u16, S>

Source§

fn queue_pop( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the (front of the) queue. Read more
Source§

fn queue_push( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the (back of the) queue. Read more
Source§

impl<T, const CAP: usize, S: Storage> DataQueue for Destaque<T, CAP, u32, S>

Source§

fn queue_pop( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the (front of the) queue. Read more
Source§

fn queue_push( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the (back of the) queue. Read more
Source§

impl<T, const CAP: usize, S: Storage> DataQueue for Destaque<T, CAP, u8, S>

Source§

fn queue_pop( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the (front of the) queue. Read more
Source§

fn queue_push( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the (back of the) queue. Read more
Source§

impl<T, const CAP: usize, S: Storage> DataQueue for Destaque<T, CAP, usize, S>

Source§

fn queue_pop( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the (front of the) queue. Read more
Source§

fn queue_push( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the (back of the) queue. Read more
Source§

impl<T, const CAP: usize, S: Storage> DataStack for Destaque<T, CAP, u16, S>

Source§

fn stack_pop( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the (back of the) stack.
Source§

fn stack_push( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the (back of the) stack.
Source§

impl<T, const CAP: usize, S: Storage> DataStack for Destaque<T, CAP, u32, S>

Source§

fn stack_pop( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the (back of the) stack.
Source§

fn stack_push( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the (back of the) stack.
Source§

impl<T, const CAP: usize, S: Storage> DataStack for Destaque<T, CAP, u8, S>

Source§

fn stack_pop( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the (back of the) stack.
Source§

fn stack_push( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the (back of the) stack.
Source§

impl<T, const CAP: usize, S: Storage> DataStack for Destaque<T, CAP, usize, S>

Source§

fn stack_pop( &mut self, ) -> Result<<Self as DataCollection>::Element, NotEnoughElements>

Remove an element from the (back of the) stack.
Source§

fn stack_push( &mut self, element: <Self as DataCollection>::Element, ) -> Result<(), NotEnoughSpace>

Add an element to the (back of the) stack.
Source§

impl<T: Debug, const CAP: usize, IDX: Debug, S: Storage> Debug for Destaque<T, CAP, IDX, S>
where S::Stored<[T; CAP]>: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default, const CAP: usize, IDX: Default> Default for Destaque<T, CAP, IDX, Bare>

Source§

fn default() -> Self

Returns an empty queue, allocated in the stack, using the default value to fill the remaining free data.

Source§

impl<T: Default, const CAP: usize, IDX: Default> Default for Destaque<T, CAP, IDX, Boxed>

Source§

fn default() -> Self

Returns an empty queue, allocated in the heap, using the default value to fill the remaining free data.

§Examples
let mut q = DestaqueU8::<i32, 100, Boxed>::default();
Source§

impl<__D: Fallible + ?Sized, T, const CAP: usize, IDX, S: Storage> Deserialize<Destaque<T, CAP, IDX, S>, __D> for Archived<Destaque<T, CAP, IDX, S>>
where Array<T, CAP, S>: Archive, <Array<T, CAP, S> as Archive>::Archived: Deserialize<Array<T, CAP, S>, __D>, IDX: Archive, <IDX as Archive>::Archived: Deserialize<IDX, __D>,

Source§

fn deserialize( &self, deserializer: &mut __D, ) -> Result<Destaque<T, CAP, IDX, S>, <__D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl<T: Default, I, const CAP: usize> From<I> for Destaque<T, CAP, u16, Bare>
where I: IntoIterator<Item = T>,

Source§

fn from(iterator: I) -> Destaque<T, CAP, u16, Bare>

Returns a queue filled with an iterator, in the stack.

§Examples
let q: DestaqueU16<_, 3> = [1, 2, 3].into();
Source§

impl<T: Default, I, const CAP: usize> From<I> for Destaque<T, CAP, u16, Boxed>
where I: IntoIterator<Item = T>,

Source§

fn from(iterator: I) -> Destaque<T, CAP, u16, Boxed>

Returns a queue filled with an iterator, in the heap.

§Examples
let q: DestaqueU16<_, 3, Boxed> = [1, 2, 3].into();
Source§

impl<T: Default, I, const CAP: usize> From<I> for Destaque<T, CAP, u32, Bare>
where I: IntoIterator<Item = T>,

Source§

fn from(iterator: I) -> Destaque<T, CAP, u32, Bare>

Returns a queue filled with an iterator, in the stack.

§Examples
let q: DestaqueU32<_, 3> = [1, 2, 3].into();
Source§

impl<T: Default, I, const CAP: usize> From<I> for Destaque<T, CAP, u32, Boxed>
where I: IntoIterator<Item = T>,

Source§

fn from(iterator: I) -> Destaque<T, CAP, u32, Boxed>

Returns a queue filled with an iterator, in the heap.

§Examples
let q: DestaqueU32<_, 3, Boxed> = [1, 2, 3].into();
Source§

impl<T: Default, I, const CAP: usize> From<I> for Destaque<T, CAP, u8, Bare>
where I: IntoIterator<Item = T>,

Source§

fn from(iterator: I) -> Destaque<T, CAP, u8, Bare>

Returns a queue filled with an iterator, in the stack.

§Examples
let q: DestaqueU8<_, 3> = [1, 2, 3].into();
Source§

impl<T: Default, I, const CAP: usize> From<I> for Destaque<T, CAP, u8, Boxed>
where I: IntoIterator<Item = T>,

Source§

fn from(iterator: I) -> Destaque<T, CAP, u8, Boxed>

Returns a queue filled with an iterator, in the heap.

§Examples
let q: DestaqueU8<_, 3, Boxed> = [1, 2, 3].into();
Source§

impl<T: Default, I, const CAP: usize> From<I> for Destaque<T, CAP, usize, Bare>
where I: IntoIterator<Item = T>,

Source§

fn from(iterator: I) -> Destaque<T, CAP, usize, Bare>

Returns a queue filled with an iterator, in the stack.

§Examples
let q: DestaqueUsize<_, 3> = [1, 2, 3].into();
Source§

impl<T: Default, I, const CAP: usize> From<I> for Destaque<T, CAP, usize, Boxed>
where I: IntoIterator<Item = T>,

Source§

fn from(iterator: I) -> Destaque<T, CAP, usize, Boxed>

Returns a queue filled with an iterator, in the heap.

§Examples
let q: DestaqueUsize<_, 3, Boxed> = [1, 2, 3].into();
Source§

impl<T: Ord, const CAP: usize, S: Storage> Ord for Destaque<T, CAP, u16, S>
where S::Stored<[T; CAP]>: Ord,

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: Ord, const CAP: usize, S: Storage> Ord for Destaque<T, CAP, u32, S>
where S::Stored<[T; CAP]>: Ord,

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: Ord, const CAP: usize, S: Storage> Ord for Destaque<T, CAP, u8, S>
where S::Stored<[T; CAP]>: Ord,

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: Ord, const CAP: usize, S: Storage> Ord for Destaque<T, CAP, usize, S>
where S::Stored<[T; CAP]>: Ord,

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: PartialEq, const CAP: usize, IDX: PartialEq, S: Storage> PartialEq for Destaque<T, CAP, IDX, S>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialOrd, const CAP: usize, S: Storage> PartialOrd for Destaque<T, CAP, u16, S>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T: PartialOrd, const CAP: usize, S: Storage> PartialOrd for Destaque<T, CAP, u32, S>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T: PartialOrd, const CAP: usize, S: Storage> PartialOrd for Destaque<T, CAP, u8, S>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T: PartialOrd, const CAP: usize, S: Storage> PartialOrd for Destaque<T, CAP, usize, S>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<__S: Fallible + ?Sized, T, const CAP: usize, IDX, S: Storage> Serialize<__S> for Destaque<T, CAP, IDX, S>
where Array<T, CAP, S>: Serialize<__S>, IDX: Serialize<__S>,

Source§

fn serialize( &self, serializer: &mut __S, ) -> Result<<Self as Archive>::Resolver, <__S as Fallible>::Error>

Writes the dependencies for the object and returns a resolver that can create the archived type.
Source§

impl<T: Copy, const CAP: usize, IDX: Copy, S: Storage> Copy for Destaque<T, CAP, IDX, S>
where S::Stored<[T; CAP]>: Copy,

Source§

impl<T: Eq, const CAP: usize, IDX: Eq, S: Storage> Eq for Destaque<T, CAP, IDX, S>
where S::Stored<[T; CAP]>: Eq,

Auto Trait Implementations§

§

impl<T, const CAP: usize, IDX, S> Freeze for Destaque<T, CAP, IDX, S>
where IDX: Freeze, <S as Storage>::Stored<[T; CAP]>: Freeze,

§

impl<T, const CAP: usize, IDX, S> RefUnwindSafe for Destaque<T, CAP, IDX, S>

§

impl<T, const CAP: usize, IDX, S> Send for Destaque<T, CAP, IDX, S>
where IDX: Send, <S as Storage>::Stored<[T; CAP]>: Send,

§

impl<T, const CAP: usize, IDX, S> Sync for Destaque<T, CAP, IDX, S>
where IDX: Sync, <S as Storage>::Stored<[T; CAP]>: Sync,

§

impl<T, const CAP: usize, IDX, S> Unpin for Destaque<T, CAP, IDX, S>
where IDX: Unpin, <S as Storage>::Stored<[T; CAP]>: Unpin,

§

impl<T, const CAP: usize, IDX, S> UnwindSafe for Destaque<T, CAP, IDX, S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
§

impl<T> ArchiveUnsized for T
where T: Archive,

§

type Archived = <T as Archive>::Archived

The archived counterpart of this type. Unlike Archive, it may be unsized. Read more
§

fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata

Creates the archived version of the metadata for this value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByteSized for T

Source§

const BYTE_ALIGN: usize = _

The alignment of this type in bytes.
Source§

const BYTE_SIZE: usize = _

The size of this type in bytes.
Source§

fn byte_align(&self) -> usize

Returns the alignment of this type in bytes.
Source§

fn byte_size(&self) -> usize

Returns the size of this type in bytes. Read more
Source§

fn ptr_size_ratio(&self) -> [usize; 2]

Returns the size ratio between Ptr::BYTES and BYTE_SIZE. Read more
Source§

impl<T, R> Chain<R> for T
where T: ?Sized,

Source§

fn chain<F>(self, f: F) -> R
where F: FnOnce(Self) -> R, Self: Sized,

Chain a function which takes the parameter by value.
Source§

fn chain_ref<F>(&self, f: F) -> R
where F: FnOnce(&Self) -> R,

Chain a function which takes the parameter by shared reference.
Source§

fn chain_mut<F>(&mut self, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Chain a function which takes the parameter by exclusive reference.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> ExtAny for T
where T: Any + ?Sized,

Source§

fn type_id() -> TypeId

Returns the TypeId of Self. Read more
Source§

fn type_of(&self) -> TypeId

Returns the TypeId of self. Read more
Source§

fn type_name(&self) -> &'static str

Returns the type name of self. Read more
Source§

fn type_is<T: 'static>(&self) -> bool

Returns true if Self is of type T. Read more
Source§

fn as_any_ref(&self) -> &dyn Any
where Self: Sized,

Upcasts &self as &dyn Any. Read more
Source§

fn as_any_mut(&mut self) -> &mut dyn Any
where Self: Sized,

Upcasts &mut self as &mut dyn Any. Read more
Source§

fn as_any_box(self: Box<Self>) -> Box<dyn Any>
where Self: Sized,

Upcasts Box<self> as Box<dyn Any>. Read more
Source§

fn downcast_ref<T: 'static>(&self) -> Option<&T>

Available on crate feature unsafe_layout only.
Returns some shared reference to the inner value if it is of type T. Read more
Source§

fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T>

Available on crate feature unsafe_layout only.
Returns some exclusive reference to the inner value if it is of type T. Read more
Source§

impl<T> ExtMem for T
where T: ?Sized,

Source§

const NEEDS_DROP: bool = _

Know whether dropping values of this type matters, in compile-time.
Source§

fn mem_align_of<T>() -> usize

Returns the minimum alignment of the type in bytes. Read more
Source§

fn mem_align_of_val(&self) -> usize

Returns the alignment of the pointed-to value in bytes. Read more
Source§

fn mem_size_of<T>() -> usize

Returns the size of a type in bytes. Read more
Source§

fn mem_size_of_val(&self) -> usize

Returns the size of the pointed-to value in bytes. Read more
Source§

fn mem_copy(&self) -> Self
where Self: Copy,

Bitwise-copies a value. Read more
Source§

fn mem_needs_drop(&self) -> bool

Returns true if dropping values of this type matters. Read more
Source§

fn mem_drop(self)
where Self: Sized,

Drops self by running its destructor. Read more
Source§

fn mem_forget(self)
where Self: Sized,

Forgets about self without running its destructor. Read more
Source§

fn mem_replace(&mut self, other: Self) -> Self
where Self: Sized,

Replaces self with other, returning the previous value of self. Read more
Source§

fn mem_take(&mut self) -> Self
where Self: Default,

Replaces self with its default value, returning the previous value of self. Read more
Source§

fn mem_swap(&mut self, other: &mut Self)
where Self: Sized,

Swaps the value of self and other without deinitializing either one. Read more
Source§

unsafe fn mem_zeroed<T>() -> T

Available on crate feature unsafe_layout only.
Returns the value of type T represented by the all-zero byte-pattern. Read more
Source§

unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst

Available on crate feature unsafe_layout only.
Returns the value of type T represented by the all-zero byte-pattern. Read more
Source§

fn mem_as_bytes(&self) -> &[u8]
where Self: Sync + Unpin,

Available on crate feature unsafe_slice only.
View a Sync + Unpin self as &[u8]. Read more
Source§

fn mem_as_bytes_mut(&mut self) -> &mut [u8]
where Self: Sync + Unpin,

Available on crate feature unsafe_slice only.
View a Sync + Unpin self as &mut [u8]. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

Source§

impl<T> Hook for T

Source§

fn hook_ref<F>(self, f: F) -> Self
where F: FnOnce(&Self),

Applies a function which takes the parameter by shared reference, and then returns the (possibly) modified owned value. Read more
Source§

fn hook_mut<F>(self, f: F) -> Self
where F: FnOnce(&mut Self),

Applies a function which takes the parameter by exclusive reference, and then returns the (possibly) modified owned value. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The metadata type for pointers and references to this type.
§

impl<T, S> SerializeUnsized<S> for T
where T: Serialize<S>, S: Fallible + Writer + ?Sized,

§

fn serialize_unsized( &self, serializer: &mut S, ) -> Result<usize, <S as Fallible>::Error>

Writes the object and returns the position of the archived type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

§

impl<T> Ungil for T
where T: Send,