Trait numeric_array::Lengthen [] [src]

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

Defines a NumericSequence which can be lengthened or extended by appending an element to the end of it.

Additionally, any lengthened sequence can be shortened by removing the last element.

Associated Types

NumericSequence that has one more element than Self

Required Methods

Moves all the current elements into a new array with one more element than the current one.

The last element of the new array is set to last

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, b.lengthen(4));

Implementors