Trait numeric_array::Shorten [] [src]

pub trait Shorten<T>: NumericSequence<T> {
    type Shorter: Lengthen<T, Longer = Self>;
    fn shorten(self) -> (Self::Shorter, T);
}

Defines a NumericSequence which can be shortened by removing the last element in it.

Additionally, any shortened sequence can be lengthened by adding an element to the end of it.

Associated Types

NumericSequence that has one less element than Self

Required Methods

Moves all but the last element into a NumericArray with one less element than the current one.

Example:

Be careful when using this code, it's not being tested!
let a = NumericArray::new(arr![i32; 1, 2, 3, 4]);
let b = NumericArray::new(arr![i32; 1, 2, 3]);

assert_eq!(a.shorten().0, b);

Implementors