Trait cl_array_ext::ArrayExt[][src]

pub trait ArrayExt<T, const N: usize>: Sized {
    fn array_split_at<const M: usize>(self) -> ([T; M], [T; N - M])
    where
        [T; N - M]: Sized
;
fn append<const M: usize>(self, other: [T; M]) -> [T; N + M]; fn truncate<const M: usize>(self) -> [T; M]
    where
        [T; N - M]: Sized
, { ... } }
Expand description

Trait that extends upon array

Required methods

Split an array into two smaller arrays

use cl_array_ext::ArrayExt;
let (a, b) = [1_i32, 2, 3, 4, 5].array_split_at::<3>();
assert_eq!(a, [1, 2, 3]);
assert_eq!(b, [4, 5]);

Join two arrays into one larger array

use cl_array_ext::ArrayExt;
let a = [1_i32, 2, 3].append([4, 5]);
assert_eq!(a, [1, 2, 3, 4, 5]);

Provided methods

Take only M elements out of the array

use cl_array_ext::ArrayExt;
let a = [1, 2, 3, 4, 5].truncate::<3>();
assert_eq!(a, [1, 2, 3]);

Implementations on Foreign Types

Implementors