Trait atools::Pop

source ·
pub trait Pop<T, const N: usize> {
    // Required methods
    fn pop_front(self) -> (T, [T; { _ }]);
    fn pop(self) -> ([T; { _ }], T);
}
Expand description

Pop parts of a array. Use

let [t, arr @ ..] = [1, 2];

when possible. If the length of the array is a const generic, use

let (t, arr) = [1, 2].pop_front();

Required Methods§

source

fn pop_front(self) -> (T, [T; { _ }])

Pop the front of a array.

let (t, arr) = b"abc".pop_front();
source

fn pop(self) -> ([T; { _ }], T)

Pop the back (end) of a array.

let (arr, t) = [0.1f32, 0.2, 0.3].pop();
assert_eq!(t, 0.3);

Implementations on Foreign Types§

source§

impl<T, const N: usize> Pop<T, N> for [T; N]

source§

const fn pop_front(self) -> (T, [T; { _ }])

source§

const fn pop(self) -> ([T; { _ }], T)

Implementors§