pub trait SplitArray<const LEN: usize> {
    type Output<const OUT_SIZE: usize>: SplitArray<OUT_SIZE>;

    // Required methods
    fn split_arr<const LEFT: usize>(
        &self
    ) -> (&Self::Output<LEFT>, &Self::Output<{ _ }>)
       where (): True<{ _ }>;
    fn split_arr_mut<const LEFT: usize>(
        &mut self
    ) -> (&mut Self::Output<LEFT>, &mut Self::Output<{ _ }>)
       where (): True<{ _ }>;
}
Expand description

Split array references in two with compile-time size validation.

Required Associated Types§

source

type Output<const OUT_SIZE: usize>: SplitArray<OUT_SIZE>

The result of a split.

Required Methods§

source

fn split_arr<const LEFT: usize>( &self ) -> (&Self::Output<LEFT>, &Self::Output<{ _ }>)
where (): True<{ _ }>,

Split an array reference into a reference to the left half and a reference to the right half. The sizes of the halves are validated at compile time.

source

fn split_arr_mut<const LEFT: usize>( &mut self ) -> (&mut Self::Output<LEFT>, &mut Self::Output<{ _ }>)
where (): True<{ _ }>,

Mutable version of Self::split_arr

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T, const LEN: usize> SplitArray<LEN> for [T; LEN]

§

type Output<const OUT_SIZE: usize> = [T; OUT_SIZE]

source§

fn split_arr<const LEFT: usize>(&self) -> (&[T; LEFT], &[T; { _ }])
where (): True<{ _ }>,

source§

fn split_arr_mut<const LEFT: usize>( &mut self ) -> (&mut [T; LEFT], &mut [T; { _ }])
where (): True<{ _ }>,

Implementors§