This crate provides simple way to split array in 2 owned arrays with compile-time bounds checks.
- Works with
Non-Copy&Non-Clonetypes
Common usage:
use SplitOwned;
let arr: = ;
let = arr.;
assert_eq!;
assert_eq!;
use SplitOwned;
let arr: = ;
let arr1: ;
let arr2: ;
= arr.split_owned;
assert_eq!;
assert_eq!;
Does not compile
use split_owned::SplitOwned;
let arr: [i32; 7] = [0, 1, 2, 3, 4, 5, 6];
// Compile error:
// Length of original array has to be equal to sum of lengths of resulting arrays N == K + L
let (arr1, arr2) = arr.split_owned::<2, 4>();
Non-Clone type
use SplitOwned;
;
let arr: = ;
let = arr.;
assert_eq!;
assert_eq!;