[][src]Struct binjs::io::entropy::dictionary::LinearTable

pub struct LinearTable<T> where
    T: Eq + Hash + Clone
{ /* fields omitted */ }

A data structure designed to cache information accessible either by index or by value.

Methods

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

pub fn shared_len(&self) -> usize[src]

The number of values representing shared dictionary entries in this table.

pub fn prelude_len(&self) -> usize[src]

The number of values representing prelude dictionary entries in this table.

pub fn len(&self) -> usize[src]

The number of values in this table.

impl<T> LinearTable<T> where
    T: Eq + Hash + Clone + Debug + Ord
[src]

pub fn new(
    value_to_instances: HashMap<T, FilesContaining, RandomState>,
    threshold: FilesContaining
) -> LinearTable<T>
[src]

Create a new LinearTable from a list of instances.

Values appearing in instances that have threshold instances or less are ignored.

pub fn with_capacity(len: usize) -> LinearTable<T>[src]

Create an empty LinearTable.

pub fn fetch_index(&mut self, value: &T) -> Fetch<TableRef>[src]

Attempt to get the index for a value from the LinearTable.

If the value is already in the cache, return Fetch::Hit(index), where index is the immutable index of the value. Otherwise, allocate a new slot index and return Fetch::Miss(index).

In both Fetch::Hit(index) and Fetch::Miss(index), 0 is the first value, 1 the second value, etc.

pub fn with_prelude(&self, prelude: &'a [T]) -> Result<LinearTable<T>, &'a T>[src]

Create a copy of the current LinearTable with an added prelude dictionary.

pub fn at_index(&self, table_ref: &TableRef) -> Option<&T>[src]

Access the contents of this table by index.

Trait Implementations

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

impl<T> Debug for LinearTable<T> where
    T: Debug + Eq + Hash + Clone
[src]

impl<'de, T> Deserialize<'de> for LinearTable<T> where
    T: Eq + Hash + Clone + Deserialize<'de>, 
[src]

impl<T> Serialize for LinearTable<T> where
    T: Eq + Hash + Clone + Serialize
[src]

Auto Trait Implementations

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

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

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

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

impl<T> UnwindSafe for LinearTable<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> DeserializeOwned for T where
    T: Deserialize<'de>, 
[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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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]