[][src]Struct binjs_io::entropy::rw::TableRefStreamState

pub struct TableRefStreamState<T> { /* fields omitted */ }

State of a input/output stream of TableRef.

Used to (de)serialize TableRef, as the encoding of an TableRef may depend on that of previous values.

Format

u32 representation: TableRef interpretation

Design notes

The main goals of this format are to:

Experiments show that the use of 0 and, for some streams, the Recall Window Range, expose such useful patterns.

Experiments show that the dual Imported Shared References/First-time Shared References mechanism considerably decrease the sparsity of references into the shared dictionary. Where raw references into the shared dictionary are typically represented by a 3 bytes long varnum, consisting in unpredictable bytes, this mechanism tends to reduce them to varnums that may be represented with either 1 byte or 2 bytes with a small (hence easy to predict) first byte. In turn, this exposes patterns that the stream compressor may use efficiently.

Methods

impl<T> TableRefStreamState<T> where
    T: Eq + Hash + Clone
[src]

pub fn new(window_max_len: usize, table: &LinearTable<T>) -> Self[src]

Create a new TableRefStreamState.

window_max_len represents the number of integers to reserve to represent backreferences to values encountered recently.

pub fn from_u32(&mut self, value: u32) -> Option<TableRef>[src]

Decode a TableRef from a u32.

pub fn into_u32(&mut self, value: TableRef) -> u32[src]

Encode an TableRef into a u32.

This method does not perform any kind of sanity check on the TableRef.

Trait Implementations

impl<T: Debug> Debug for TableRefStreamState<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for TableRefStreamState<T> where
    T: RefUnwindSafe

impl<T> Send for TableRefStreamState<T> where
    T: Send

impl<T> Sync for TableRefStreamState<T> where
    T: Sync

impl<T> Unpin for TableRefStreamState<T> where
    T: Unpin

impl<T> UnwindSafe for TableRefStreamState<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]