pub trait Split<T, const N: usize> {
// Required methods
fn split<const AT: usize>(self) -> ([T; AT], [T; { _ }]);
fn take<const AT: usize>(self) -> [T; AT]
where [(); { _ }]:,
T:;
fn drop<const AT: usize>(self) -> [T; { _ }]
where T:;
}Expand description
Splitting arrays up.
Required Methods§
Sourcefn split<const AT: usize>(self) -> ([T; AT], [T; { _ }])
fn split<const AT: usize>(self) -> ([T; AT], [T; { _ }])
Splits the array into twain.
let x = [1u8, 2, 3];
let ([x], [y, z]) = x.split::<1>();Sourcefn take<const AT: usize>(self) -> [T; AT]
fn take<const AT: usize>(self) -> [T; AT]
Take AT elements, discarding the rest.
assert_eq!(range::<50>().take::<5>(), range::<5>());Sourcefn drop<const AT: usize>(self) -> [T; { _ }]where
T:,
fn drop<const AT: usize>(self) -> [T; { _ }]where
T:,
Discard AT elements, returning the rest.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.