Struct sux::dict::rear_coded_list::RearCodedList
source · 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>
impl<D: AsRef<[u8]>, P: AsRef<[usize]>> RearCodedList<D, P>
sourcepub fn get_inplace(&self, index: usize, result: &mut Vec<u8>)
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>
impl<D: AsRef<[u8]>, P: AsRef<[usize]>> RearCodedList<D, P>
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>
impl<D: Clone + AsRef<[u8]>, P: Clone + AsRef<[usize]>> Clone for RearCodedList<D, P>
source§fn clone(&self) -> RearCodedList<D, P>
fn clone(&self) -> RearCodedList<D, P>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<D, P> CopyType for RearCodedList<D, P>
impl<D, P> CopyType for RearCodedList<D, P>
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]>,
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]>,
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>>
type DeserType<'epserde_desertype> = RearCodedList<<D as DeserializeInner>::DeserType<'epserde_desertype>, <P as DeserializeInner>::DeserType<'epserde_desertype>>
DeserType
.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>
impl<D: AsRef<[u8]>, P: AsRef<[usize]>> IndexedDict for RearCodedList<D, P>
source§fn contains(&self, string: &Self::Input) -> bool
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
unsafe fn get_unchecked(&self, index: usize) -> Self::Output
source§impl<'a, D: AsRef<[u8]>, P: AsRef<[usize]>> IntoIterator for &'a RearCodedList<D, P>
impl<'a, D: AsRef<[u8]>, P: AsRef<[usize]>> IntoIterator for &'a RearCodedList<D, P>
source§impl<'a, D: AsRef<[u8]>, P: AsRef<[usize]>> IntoLender for &'a RearCodedList<D, P>
impl<'a, D: AsRef<[u8]>, P: AsRef<[usize]>> IntoLender for &'a RearCodedList<D, P>
source§impl<D, P> MemDbgImpl for RearCodedList<D, P>where
usize: MemDbgImpl,
bool: MemDbgImpl,
D: MemDbgImpl + AsRef<[u8]>,
P: MemDbgImpl + AsRef<[usize]>,
impl<D, P> MemDbgImpl for RearCodedList<D, P>where
usize: MemDbgImpl,
bool: MemDbgImpl,
D: MemDbgImpl + AsRef<[u8]>,
P: MemDbgImpl + AsRef<[usize]>,
source§impl<D, P> MemSize for RearCodedList<D, P>
impl<D, P> MemSize for RearCodedList<D, P>
source§impl<D: AsRef<[u8]> + ReprHash, P: AsRef<[usize]> + ReprHash> ReprHash for RearCodedList<D, P>
impl<D: AsRef<[u8]> + ReprHash, P: AsRef<[usize]> + ReprHash> ReprHash for RearCodedList<D, P>
source§impl<D, P> SerializeInner for RearCodedList<D, P>where
usize: SerializeInner,
bool: SerializeInner,
D: SerializeInner + AsRef<[u8]>,
P: SerializeInner + AsRef<[usize]>,
impl<D, P> SerializeInner for RearCodedList<D, P>where
usize: SerializeInner,
bool: SerializeInner,
D: SerializeInner + AsRef<[u8]>,
P: SerializeInner + AsRef<[usize]>,
source§const IS_ZERO_COPY: bool = _
const IS_ZERO_COPY: bool = _
ZeroCopy
type has this constant set to false
serialization will panic.source§const ZERO_COPY_MISMATCH: bool = _
const ZERO_COPY_MISMATCH: bool = _
#[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<()>
fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>
Auto Trait Implementations§
impl<D, P> Freeze for RearCodedList<D, P>
impl<D, P> RefUnwindSafe for RearCodedList<D, P>where
D: RefUnwindSafe,
P: RefUnwindSafe,
impl<D, P> Send for RearCodedList<D, P>
impl<D, P> Sync for RearCodedList<D, P>
impl<D, P> Unpin for RearCodedList<D, P>
impl<D, P> UnwindSafe for RearCodedList<D, P>where
D: UnwindSafe,
P: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
source§impl<T> Deserialize for T
impl<T> Deserialize for T
source§fn deserialize_full(backend: &mut impl ReadNoStd) -> Result<T, Error>
fn deserialize_full(backend: &mut impl ReadNoStd) -> Result<T, Error>
source§fn deserialize_eps(
backend: &[u8]
) -> Result<<T as DeserializeInner>::DeserType<'_>, Error>
fn deserialize_eps( backend: &[u8] ) -> Result<<T as DeserializeInner>::DeserType<'_>, Error>
source§fn load_full(path: impl AsRef<Path>) -> Result<Self, Error>
fn load_full(path: impl AsRef<Path>) -> Result<Self, Error>
source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
source§impl<T> MemDbg for Twhere
T: MemDbgImpl,
impl<T> MemDbg for Twhere
T: MemDbgImpl,
source§fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>
fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>
source§fn mem_dbg_on(
&self,
writer: &mut impl Write,
flags: DbgFlags
) -> Result<(), Error>
fn mem_dbg_on( &self, writer: &mut impl Write, flags: DbgFlags ) -> Result<(), Error>
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>
fn mem_dbg_depth( &self, total_size: usize, max_depth: usize, flags: DbgFlags ) -> Result<(), Error>
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>
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>
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
impl<T> Pointable for T
source§impl<T> Serialize for T
impl<T> Serialize for T
source§fn serialize_on_field_write(
&self,
backend: &mut impl WriteWithNames
) -> Result<(), Error>
fn serialize_on_field_write( &self, backend: &mut impl WriteWithNames ) -> Result<(), Error>
Serialize the type using the given WriteWithNames
.