pub trait NanoArray: Copy + Clone + Sized + PartialEq + Eq {
    type Packed;
    type Element: PrimInt + Unsigned;

    const LENGTH: usize;
Show 14 methods fn new() -> Self; fn from_packed(packed: Self::Packed) -> Self; fn packed(self) -> Self::Packed; fn max_elem() -> Self::Element; fn get_unchecked(self, i: usize) -> Self::Element; fn shift_high(self, n: usize) -> Self; fn shift_low(self, n: usize) -> Self; fn get(self, i: usize) -> Self::Element { ... } fn with(self, i: usize, elem: Self::Element) -> Self { ... } fn set(&mut self, i: usize, elem: Self::Element) { ... } fn with_unchecked(self, i: usize, elem: Self::Element) -> Self { ... } fn set_unchecked(&mut self, i: usize, elem: Self::Element) { ... } fn rotate_high(self, n: usize) -> Self { ... } fn rotate_low(self, n: usize) -> Self { ... }
}
Expand description

A fixed-length array of unsigned integers in the range 0..(Self::max_elem()). May be stored in a compressed format, and therefore does not provide references; this means no core::ops::Index or core::ops::IndexMut required, and no slicing.

The following operations are required to be implemented:

Required Associated Types

The underlying representation of this array.

The element type of this array; must be an unsigned primitive integer. Note that it’s not guaranteed that all values that can fit the type is allowed; see Self::max_elem().

Required Associated Constants

The fixed length of this array.

Required Methods

Creates an all-zero array.

Creates an array from its underlying representation.

Converts the array to its underlying representation.

Returns the maximum element allowed in this array.

Returns the i-th element of this array. Behavior when the index is out of bounds is unspecified (okay to panic).

Shifts this array n elements towards the higher index. The lower indices will be left as 0. Behavior when n > Self::LENGTH is unspecified (okay to panic).

Example: shift_high([A, B, C, D], 1) == [0, A, B, C]

Shifts this array n elements towards the lower index The higher indices will be left as 0. Behavior when n > Self::LENGTH is unspecified (okay to panic).

Example: shift_low([A, B, C, D], 1) == [B, C, D, 0]

Provided Methods

Returns the i-th element of this array. Panics if the index is out of bounds.

Returns a new array = this array with the i-th element set to elem (a.k.a. immutable set index). Panics if the index is out of bounds or the element is out of range.

Sets the i-th element of this array to elem. Panics if the index is out of bounds or the element is out of range.

Returns a new array = this array with the i-th element set to elem (a.k.a. immutable set index). Behavior when the index is out of bounds is unspecified (okay to panic).

Implementer must provide at least one of Self::with_unchecked, Self::set_unchecked.

Sets the i-th element of this array to elem. Behavior when the index is out of bounds is unspecified (okay to panic).

Implementer must provide at least one of Self::with_unchecked, Self::set_unchecked.

Rotates this array n elements towards the higher index. This is equivalent to rotate_low(Self::LENGTH - n). Panics when n > Self::LENGTH.

Example: rotate_high([A, B, C, D], 1) == [D, A, B, C]

Implementer must provide at least one of Self::rotate_high, Self::rotate_low.

Rotates this array n elements towards the lower index. This is equivalent to rotate_high(Self::LENGTH - n). Panics when n > Self::LENGTH.

Example: rotate_low([A, B, C, D], 1) == [B, C, D, A]

Implementer must provide at least one of Self::rotate_high, Self::rotate_low.

Implementations on Foreign Types

Implementors