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
Required Methods
fn lengthen(self, last: T) -> Self::Longer
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
impl<T, N: ArrayLength<T>> Lengthen<T> for NumericArray<T, N> where
N: Add<B1>,
Add1<N>: ArrayLength<T>,
Add1<N>: Sub<B1, Output = N>,
Sub1<Add1<N>>: ArrayLength<T>, type Longer = NumericArray<T, Add1<N>>;