Skip to main content

Packed

Struct Packed 

Source
pub struct Packed<C, const P: usize> { /* private fields */ }
Expand description

Unpacks P sub-codes from one stored byte, then defers to C.

The i4 tier is Packed<Grid<16>, 2>. Low sub-code first — normative, pinned by case nibble-order and asserted by CK-03.

P is arbitrary: two nibbles, four two-bit codes, eight one-bit codes. The sub-code width is 8 / P, so P must divide 8, which Packed::new checks once at construction.

Implementations§

Source§

impl<C, const P: usize> Packed<C, P>

Source

pub const SUB_BITS: u32

Bits per sub-code.

Source

pub fn new(inner: C) -> Option<Self>

Wrap inner, unpacking P sub-codes per byte.

None when P does not divide 8, which means no such packing exists.

Trait Implementations§

Source§

impl<C: Clone, const P: usize> Clone for Packed<C, P>

Source§

fn clone(&self) -> Packed<C, P>

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, Bd, C, const P: usize> Codec<E, Bd> for Packed<C, P>
where E: IntegerElement, Bd: Bound, C: Codec<E, Bd>, C::Code: From<u8>,

Source§

const MAX_BLOCK: usize

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

const TIER: TierId = TierId::Packed

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

const IS_FIXED_WIDTH: bool = C::IS_FIXED_WIDTH

Is decode_len always MAX_BLOCK? Read more
Source§

type Code = u8

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§

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<C: Copy, const P: usize> Copy for Packed<C, P>

Source§

impl<C: Debug, const P: usize> Debug for Packed<C, P>

Source§

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

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

impl<E, Bd, C, const P: usize> Enumerable<E, Bd> for Packed<C, P>
where E: IntegerElement, Bd: Bound, C: Enumerable<E, Bd>, C::Code: From<u8>,

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§

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
Source§

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

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

Auto Trait Implementations§

§

impl<C, const P: usize> Freeze for Packed<C, P>
where C: Freeze,

§

impl<C, const P: usize> RefUnwindSafe for Packed<C, P>
where C: RefUnwindSafe,

§

impl<C, const P: usize> Send for Packed<C, P>
where C: Send,

§

impl<C, const P: usize> Sync for Packed<C, P>
where C: Sync,

§

impl<C, const P: usize> Unpin for Packed<C, P>
where C: Unpin,

§

impl<C, const P: usize> UnsafeUnpin for Packed<C, P>
where C: UnsafeUnpin,

§

impl<C, const P: usize> UnwindSafe for Packed<C, P>
where C: UnwindSafe,

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.