Skip to main content

Grid

Struct Grid 

Source
pub struct Grid<'a, E: IntegerElement, Bd: Bound, const N: usize> { /* private fields */ }
Expand description

Any lookup codec, of any code width.

The 16-entry i4 grid is Grid<16>; a 65536-entry one is Grid<65536>. The library carries no hardcoded table size, and no size is privileged.

The code space of an N-entry grid is Z/N, so an arbitrary u16 indexes it modulo N. That is not a clamp and not an error path: it is what “index into a table of N entries” means, and it is why this decode is total on all 2^16 codes (C6).

Implementations§

Source§

impl<'a, E: IntegerElement, Bd: Bound, const N: usize> Grid<'a, E, Bd, N>

Source

pub const fn new(table: &'a [Alphabet<E, Bd>; N]) -> Self

Borrow a decode table. The table is Alphabet<E, Bd>, so its image is in the alphabet by construction and there is nothing to validate.

Source

pub const fn table(&self) -> &'a [Alphabet<E, Bd>; N]

The table.

Trait Implementations§

Source§

impl<'a, E: Clone + IntegerElement, Bd: Clone + Bound, const N: usize> Clone for Grid<'a, E, Bd, N>

Source§

fn clone(&self) -> Grid<'a, E, Bd, N>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: IntegerElement, Bd: Bound, const N: usize> Codec<E, Bd> for Grid<'_, E, Bd, N>

Source§

const MAX_BLOCK: usize = 1

The most alphabet elements one code can produce. Read more
Source§

const TIER: TierId = TierId::Grid

Which tier this is, for reports and for the kappa manifest.
Source§

type Code = u16

The stored code type. Read more
Source§

fn decode_element(&self, code: Self::Code, _i: usize) -> Alphabet<E, Bd>

Decode element i of the block code names. Total for every i. Read more
Source§

const IS_FIXED_WIDTH: bool = true

Is decode_len always MAX_BLOCK? Read more
Source§

fn decode_len(&self, _code: Self::Code) -> usize

How many elements code actually produces. Read more
Source§

fn decode_into(&self, code: Self::Code, out: &mut [Alphabet<E, Bd>]) -> usize

Decode one code, returning how many elements were written. Read more
Source§

fn decode_seq(&self, codes: &[Self::Code], out: &mut [Alphabet<E, Bd>]) -> usize

Bulk path, returning how many elements were written in total.
Source§

impl<'a, E: Copy + IntegerElement, Bd: Copy + Bound, const N: usize> Copy for Grid<'a, E, Bd, N>

Source§

impl<'a, E: Debug + IntegerElement, Bd: Debug + Bound, const N: usize> Debug for Grid<'a, E, Bd, N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E: IntegerElement, Bd: Bound, const N: usize> Enumerable<E, Bd> for Grid<'_, E, Bd, N>

Source§

const CODE_SPACE: usize

The number of distinct codes. Read more
Source§

fn code_at(index: usize) -> Self::Code

The index-th code. Total for index < CODE_SPACE.
Source§

fn index_of(code: Self::Code) -> usize

Where code sits in the enumeration. Read more
Source§

fn as_index_stream(codes: &[u16]) -> Option<IndexStream<'_>>

The stored code stream, read as the index stream it already is. Read more
Source§

const SIGN_BIT_BOOK: bool = false

Whether the decoded book is the sign bit-decomposition: CODE_SPACE is a power of two and book[c][t] == 2 * bit(c, t) - 1 for every code c and every t below its log. Read more

Auto Trait Implementations§

§

impl<'a, E, Bd, const N: usize> Freeze for Grid<'a, E, Bd, N>

§

impl<'a, E, Bd, const N: usize> RefUnwindSafe for Grid<'a, E, Bd, N>

§

impl<'a, E, Bd, const N: usize> Send for Grid<'a, E, Bd, N>

§

impl<'a, E, Bd, const N: usize> Sync for Grid<'a, E, Bd, N>

§

impl<'a, E, Bd, const N: usize> Unpin for Grid<'a, E, Bd, N>

§

impl<'a, E, Bd, const N: usize> UnsafeUnpin for Grid<'a, E, Bd, N>

§

impl<'a, E, Bd, const N: usize> UnwindSafe for Grid<'a, E, Bd, N>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.