pub struct RearCodedList<D: AsRef<[u8]> = Vec<u8>, P: AsRef<[usize]> = Vec<usize>> { /* private fields */ }
Expand description

Immutable lists of strings compressed by prefix omission via rear coding.

Prefix omission compresses a list of strings omitting the common prefixes of consecutive strings. To do so, it stores the length of what remains after the common prefix (hence, rear coding). It is usually applied to lists strings sorted in ascending order.

The encoding is done in blocks of k strings: in each block the first string is encoded without compression, wheres the other strings are encoded with the common prefix removed.

Implementations§

source§

impl<D: AsRef<[u8]>, P: AsRef<[usize]>> RearCodedList<D, P>

source

pub fn get_inplace(&self, index: usize, result: &mut Vec<u8>)

Write the index-th string to result as bytes. This is useful to avoid allocating a new string for every query and skipping the UTF-8 validity check.

source§

impl<D: AsRef<[u8]>, P: AsRef<[usize]>> RearCodedList<D, P>

source

pub fn into_iter_from(&self, from: usize) -> ValueIterator<'_, D, P>

Trait Implementations§

source§

impl<D: Clone + AsRef<[u8]>, P: Clone + AsRef<[usize]>> Clone for RearCodedList<D, P>

source§

fn clone(&self) -> RearCodedList<D, P>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<D: AsRef<[u8]>, P: AsRef<[usize]>> CopyType for RearCodedList<D, P>

§

type Copy = Deep

source§

impl<D, P> CopyType for RearCodedList<D, P>
where usize: MemSize, bool: MemSize, D: MemSize + AsRef<[u8]>, P: MemSize + AsRef<[usize]>,

§

type Copy = False

source§

impl<D: Debug + AsRef<[u8]>, P: Debug + AsRef<[usize]>> Debug for RearCodedList<D, P>

source§

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

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

impl<D, P> DeserializeInner for RearCodedList<D, P>
where usize: DeserializeInner, bool: DeserializeInner, D: DeserializeInner + AsRef<[u8]>, P: DeserializeInner + AsRef<[usize]>, for<'epserde_desertype> <D as DeserializeInner>::DeserType<'epserde_desertype>: AsRef<[u8]>, for<'epserde_desertype> <P as DeserializeInner>::DeserType<'epserde_desertype>: AsRef<[usize]>,

source§

fn _deserialize_full_inner( backend: &mut impl ReadWithPos ) -> Result<Self, Error>

§

type DeserType<'epserde_desertype> = RearCodedList<<D as DeserializeInner>::DeserType<'epserde_desertype>, <P as DeserializeInner>::DeserType<'epserde_desertype>>

The deserialization type associated with this type. It can be retrieved conveniently with the alias DeserType.
source§

fn _deserialize_eps_inner<'a>( backend: &mut SliceWithPos<'a> ) -> Result<Self::DeserType<'a>, Error>

source§

impl<D: AsRef<[u8]>, P: AsRef<[usize]>> IndexedDict for RearCodedList<D, P>

source§

fn contains(&self, string: &Self::Input) -> bool

Return whether the string is contained in the array. If the strings in the list are sorted this is done with a binary search, otherwise it is done with a linear search.

§

type Output = String

§

type Input = str

source§

unsafe fn get_unchecked(&self, index: usize) -> Self::Output

Return the value at the specified index. Read more
source§

fn len(&self) -> usize

Return the length (number of items) of the dictionary.
source§

fn get(&self, index: usize) -> Self::Output

Return the value at the specified index. Read more
source§

fn is_empty(&self) -> bool

Return true if len is zero.
source§

impl<'a, D: AsRef<[u8]>, P: AsRef<[usize]>> IntoIterator for &'a RearCodedList<D, P>

§

type Item = String

The type of the elements being iterated over.
§

type IntoIter = ValueIterator<'a, D, P>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<'a, D: AsRef<[u8]>, P: AsRef<[usize]>> IntoLender for &'a RearCodedList<D, P>

§

type Lender = Iterator<'a, D, P>

source§

fn into_lender(self) -> Iterator<'a, D, P>

source§

impl<'a, 'all, D: AsRef<[u8]>, P: AsRef<[usize]>> Lending<'all> for &'a RearCodedList<D, P>

§

type Lend = &'all str

The type being lent.
source§

impl<D, P> MemDbgImpl for RearCodedList<D, P>

source§

fn _mem_dbg_rec_on( &self, _memdbg_writer: &mut impl Write, _memdbg_total_size: usize, _memdbg_max_depth: usize, _memdbg_prefix: &mut String, _memdbg_is_last: bool, _memdbg_flags: DbgFlags ) -> Result

source§

impl<D, P> MemSize for RearCodedList<D, P>
where usize: MemSize, bool: MemSize, D: MemSize + AsRef<[u8]>, P: MemSize + AsRef<[usize]>,

source§

fn mem_size(&self, _memsize_flags: SizeFlags) -> usize

Return the (recursively computed) overall memory size of the structure in bytes.
source§

impl<D: AsRef<[u8]> + ReprHash, P: AsRef<[usize]> + ReprHash> ReprHash for RearCodedList<D, P>

source§

fn repr_hash(hasher: &mut impl Hasher, offset_of: &mut usize)

Accumulate representional information in hasher assuming to be positioned at offset_of.
source§

fn repr_hash_val(&self, hasher: &mut impl Hasher, offset_of: &mut usize)

Call ReprHash::repr_hash on a value.
source§

impl<D, P> SerializeInner for RearCodedList<D, P>

source§

const IS_ZERO_COPY: bool = _

Inner constant used by the derive macros to keep track recursively of whether the type satisfies the conditions for being zero-copy. It is checked at runtime against the trait implemented by the type, and if a ZeroCopy type has this constant set to false serialization will panic.
source§

const ZERO_COPY_MISMATCH: bool = _

Inner constant used by the derive macros to keep track of whether all fields of a type are zero-copy but neither the attribute #[zero_copy] nor the attribute #[deep_copy] was specified. It is checked at runtime, and if it is true a warning will be issued, as the type could be zero-copy, which would be more efficient.
source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

Serialize this structure using the given backend.
source§

impl<D: AsRef<[u8]> + TypeHash, P: AsRef<[usize]> + TypeHash> TypeHash for RearCodedList<D, P>

source§

fn type_hash(hasher: &mut impl Hasher)

Accumulate type information in hasher.
source§

fn type_hash_val(&self, hasher: &mut impl Hasher)

Call TypeHash::type_hash on a value.

Auto Trait Implementations§

§

impl<D, P> Freeze for RearCodedList<D, P>
where D: Freeze, P: Freeze,

§

impl<D, P> RefUnwindSafe for RearCodedList<D, P>

§

impl<D, P> Send for RearCodedList<D, P>
where D: Send, P: Send,

§

impl<D, P> Sync for RearCodedList<D, P>
where D: Sync, P: Sync,

§

impl<D, P> Unpin for RearCodedList<D, P>
where D: Unpin, P: Unpin,

§

impl<D, P> UnwindSafe for RearCodedList<D, P>
where D: UnwindSafe, P: 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> CastableFrom<T> for T

source§

fn cast_from(value: T) -> T

Call Self as W
source§

impl<T, U> CastableInto<U> for T
where U: CastableFrom<T>,

source§

fn cast(self) -> U

Call W::cast_from(self)
source§

impl<T> Deserialize for T

source§

fn deserialize_full(backend: &mut impl ReadNoStd) -> Result<T, Error>

Fully deserialize a structure of this type from the given backend.
source§

fn deserialize_eps( backend: &[u8] ) -> Result<<T as DeserializeInner>::DeserType<'_>, Error>

ε-copy deserialize a structure of this type from the given backend.
source§

fn load_full(path: impl AsRef<Path>) -> Result<Self, Error>

Commodity method to fully deserialize from a file.
source§

fn load_mem<'a>( path: impl AsRef<Path> ) -> Result<MemCase<Self::DeserType<'a>>, Error>

Load a file into heap-allocated memory and ε-deserialize a data structure from it, returning a MemCase containing the data structure and the memory. Excess bytes are zeroed out. Read more
source§

fn load_mmap<'a>( path: impl AsRef<Path>, flags: Flags ) -> Result<MemCase<Self::DeserType<'a>>, Error>

Load a file into mmap()-allocated memory and ε-deserialize a data structure from it, returning a MemCase containing the data structure and the memory. Excess bytes are zeroed out. Read more
source§

fn mmap<'a>( path: impl AsRef<Path>, flags: Flags ) -> Result<MemCase<Self::DeserType<'a>>, Error>

Memory map a file and ε-deserialize a data structure from it, returning a MemCase containing the data structure and the memory mapping. Read more
source§

impl<T> DowncastableFrom<T> for T

source§

fn downcast_from(value: T) -> T

Truncate the current UnsignedInt to a possibly smaller size
source§

impl<T, U> DowncastableInto<U> for T
where U: DowncastableFrom<T>,

source§

fn downcast(self) -> U

Call W::downcast_from(self)
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> MemDbg for T
where T: MemDbgImpl,

source§

fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>

Write to stdout debug infos about the structure memory usage, expanding all levels of nested structures.
source§

fn mem_dbg_on( &self, writer: &mut impl Write, flags: DbgFlags ) -> Result<(), Error>

Write to a core::fmt::Write debug infos about the structure memory usage, expanding all levels of nested structures.
source§

fn mem_dbg_depth( &self, total_size: usize, max_depth: usize, flags: DbgFlags ) -> Result<(), Error>

Write to stdout debug infos about the structure memory usage, but expanding only up to max_depth levels of nested structures.
source§

fn mem_dbg_depth_on( &self, writer: &mut impl Write, total_size: usize, max_depth: usize, prefix: &mut String, field_name: Option<&str>, is_last: bool, flags: DbgFlags ) -> Result<(), Error>

Write to a core::fmt::Write debug infos about the structure memory usage, but expanding only up to max_depth levels of nested structures.
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Serialize for T

source§

fn serialize_on_field_write( &self, backend: &mut impl WriteWithNames ) -> Result<(), Error>

Serialize the type using the given WriteWithNames.

source§

fn serialize(&self, backend: &mut impl WriteNoStd) -> Result<usize, Error>

Serialize the type using the given backend.
source§

fn serialize_with_schema( &self, backend: &mut impl WriteNoStd ) -> Result<Schema, Error>

Serialize the type using the given backend and return a schema describing the data that has been written. Read more
source§

fn store(&self, path: impl AsRef<Path>) -> Result<(), Error>

Commodity method to serialize to a file.
source§

impl<T> Splat<T> for T

source§

fn splat(value: T) -> T

source§

impl<T> To<T> for T

source§

fn to(self) -> T

source§

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

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.
source§

impl<T> UpcastableFrom<T> for T

source§

fn upcast_from(value: T) -> T

Extend the current UnsignedInt to a possibly bigger size.
source§

impl<T, U> UpcastableInto<U> for T
where U: UpcastableFrom<T>,

source§

fn upcast(self) -> U

Call W::upcast_from(self)
source§

impl<T> DeepCopy for T
where T: CopyType<Copy = Deep>,