Skip to main content

Runs

Struct Runs 

Source
pub struct Runs<'a, E: IntegerElement, Bd: Bound, C: Codec<E, Bd>, const MAX_RUN: usize> { /* private fields */ }
Expand description

Sparse storage as a codec, not as a separate algorithm and not as a separate crate (D-16).

A run is (length, code): length consecutive decoded elements, all of them d(code). A gap is a run whose code decodes to the alphabet’s zero, so the zeros are explicit and the arithmetic downstream stays dense. No sparse-specific speedup is claimed; the benefit is residency, and CG-03 measures it like any other codec’s.

A code is a run index, and the run’s length is what Codec::decode_len reports. MAX_RUN is the longest run the caller declares, so this tier is variable-length within a compile-time bound — which is exactly what the MAX_BLOCK spelling is for (S4, S5b).

Implementations§

Source§

impl<'a, E: IntegerElement, Bd: Bound, C: Codec<E, Bd>, const MAX_RUN: usize> Runs<'a, E, Bd, C, MAX_RUN>

Source

pub fn new(inner: C, runs: &'a [(u32, C::Code)]) -> Option<Self>

Borrow a run list.

None when a run is empty or longer than MAX_RUN, both of which mean the list describes no stream. Decided at construction, before any arithmetic, like every other non-existence in this library (C6).

Source

pub const fn run_count(&self) -> usize

The number of stored runs, which is the residency this tier buys.

Source

pub fn decoded_len(&self) -> usize

The decoded length of the whole run list.

CK-06 asserts this equals the declared row width, which is the invariant that lets a variable-length tier live inside Codec.

Trait Implementations§

Source§

impl<'a, E: Clone + IntegerElement, Bd: Clone + Bound, C: Clone + Codec<E, Bd>, const MAX_RUN: usize> Clone for Runs<'a, E, Bd, C, MAX_RUN>
where C::Code: Clone,

Source§

fn clone(&self) -> Runs<'a, E, Bd, C, MAX_RUN>

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, C: Codec<E, Bd>, const MAX_RUN: usize> Codec<E, Bd> for Runs<'_, E, Bd, C, MAX_RUN>

Source§

const MAX_BLOCK: usize = MAX_RUN

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

const TIER: TierId = TierId::Runs

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

const IS_FIXED_WIDTH: bool = false

Is decode_len always MAX_BLOCK? Read more
Source§

type Code = u32

The stored code type. Read more
Source§

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

How many elements code actually produces. Read more
Source§

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

Decode element i of the block code names. Total for every i. 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, C: Copy + Codec<E, Bd>, const MAX_RUN: usize> Copy for Runs<'a, E, Bd, C, MAX_RUN>
where C::Code: Copy,

Source§

impl<'a, E: Debug + IntegerElement, Bd: Debug + Bound, C: Debug + Codec<E, Bd>, const MAX_RUN: usize> Debug for Runs<'a, E, Bd, C, MAX_RUN>
where C::Code: Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, E, Bd, C, const MAX_RUN: usize> Freeze for Runs<'a, E, Bd, C, MAX_RUN>
where C: Freeze,

§

impl<'a, E, Bd, C, const MAX_RUN: usize> RefUnwindSafe for Runs<'a, E, Bd, C, MAX_RUN>
where C: RefUnwindSafe, <C as Codec<E, Bd>>::Code: RefUnwindSafe,

§

impl<'a, E, Bd, C, const MAX_RUN: usize> Send for Runs<'a, E, Bd, C, MAX_RUN>

§

impl<'a, E, Bd, C, const MAX_RUN: usize> Sync for Runs<'a, E, Bd, C, MAX_RUN>

§

impl<'a, E, Bd, C, const MAX_RUN: usize> Unpin for Runs<'a, E, Bd, C, MAX_RUN>
where C: Unpin,

§

impl<'a, E, Bd, C, const MAX_RUN: usize> UnsafeUnpin for Runs<'a, E, Bd, C, MAX_RUN>
where C: UnsafeUnpin,

§

impl<'a, E, Bd, C, const MAX_RUN: usize> UnwindSafe for Runs<'a, E, Bd, C, MAX_RUN>
where C: UnwindSafe, <C as Codec<E, Bd>>::Code: RefUnwindSafe,

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.