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§
sourcefn pop_front(self) -> (T, [T; { _ }])
fn pop_front(self) -> (T, [T; { _ }])
Pop the front of a array.
let (t, arr) = b"abc".pop_front();
sourcefn pop(self) -> ([T; { _ }], T)
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);