pub trait Slice<T, const N: usize> {
// Required method
fn slice<const RANGE: Range>(&self) -> &[T; { _ }]
where [(); { _ }]:;
}Expand description
Slicing arrays up.
Required Methods§
Sourcefn slice<const RANGE: Range>(&self) -> &[T; { _ }]
fn slice<const RANGE: Range>(&self) -> &[T; { _ }]
Slices the array. Compile time checked.
let x = atools::range::<5>();
assert_eq!(*x.slice::<{ r(2..=4) }>(), [2, 3, 4]);
// x.slice::<{ r(..10) }>(); // ERRORDyn 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.