pub struct IndexBlock<T> { /* private fields */ }Expand description
IndexVec allows to store h3index in compressed form.
The main purpose of this is to allow having seldom used data in memory without it occupying too much space. This sacrifices a bit of speed when accessing the data.
The order if the h3indexes in the block is not changed, so - for example - continuous paths of h3 edges can be stored without them becoming shuffled.
The compression is done using run-length-encoding (RLE). To improve the compression ratio
the bytes of all contained h3indexes are grouped by their position in the u64 of the
h3index. For spatially close h3index this results in a quite good compression ratio as many
bytes are common over many h3indexes. As an example: a k-ring with k=50 and 7651 cells
compresses from 61kb to around 7.6kb.
Implementations§
Source§impl<T> IndexBlock<T>where
T: Index,
impl<T> IndexBlock<T>where
T: Index,
pub const fn len(&self) -> usize
pub const fn is_empty(&self) -> bool
Sourcepub fn contains(&self, index: &T) -> Result<bool, Error>
pub fn contains(&self, index: &T) -> Result<bool, Error>
check if index is contained in this IndexBlock.
This method avoids decompressing the whole block at once and instead only decompresses single bytes while traversing the contained indexes.
Sourcepub const fn size_of_uncompressed(&self) -> usize
pub const fn size_of_uncompressed(&self) -> usize
The size of the inner data when it would be stored in a simple Vec
pub const fn size_of_compressed(&self) -> usize
Sourcepub fn iter_uncompressed(&self) -> Result<OwningDecompressedIter<'_, T>, Error>
pub fn iter_uncompressed(&self) -> Result<OwningDecompressedIter<'_, T>, Error>
returns an iterator over the decompressed decompressed contents of the IndexBlock.
Useful for situations where only one or few decompressions are done. When
many blocks are decompressed using the Decompressor is more efficient as the
decompression buffer needs to be allocated only once.
Trait Implementations§
Source§impl<T: Clone> Clone for IndexBlock<T>
impl<T: Clone> Clone for IndexBlock<T>
Source§fn clone(&self) -> IndexBlock<T>
fn clone(&self) -> IndexBlock<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: Debug> Debug for IndexBlock<T>
impl<T: Debug> Debug for IndexBlock<T>
Source§impl<'de, T> Deserialize<'de> for IndexBlock<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for IndexBlock<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<T: Eq> Eq for IndexBlock<T>
Source§impl<T> From<IndexVec<T>> for IndexBlock<T>
impl<T> From<IndexVec<T>> for IndexBlock<T>
Source§impl<T, B> FromIterator<B> for IndexBlock<T>
impl<T, B> FromIterator<B> for IndexBlock<T>
Source§fn from_iter<I: IntoIterator<Item = B>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = B>>(iter: I) -> Self
Source§impl<T: PartialEq> PartialEq for IndexBlock<T>
impl<T: PartialEq> PartialEq for IndexBlock<T>
Source§impl<T> Serialize for IndexBlock<T>where
T: Serialize,
impl<T> Serialize for IndexBlock<T>where
T: Serialize,
impl<T: PartialEq> StructuralPartialEq for IndexBlock<T>
Auto Trait Implementations§
impl<T> Freeze for IndexBlock<T>where
PhantomData<T>: Freeze,
impl<T> RefUnwindSafe for IndexBlock<T>where
PhantomData<T>: RefUnwindSafe,
impl<T> Send for IndexBlock<T>where
PhantomData<T>: Send,
impl<T> Sync for IndexBlock<T>where
PhantomData<T>: Sync,
impl<T> Unpin for IndexBlock<T>where
PhantomData<T>: Unpin,
impl<T> UnsafeUnpin for IndexBlock<T>where
PhantomData<T>: UnsafeUnpin,
impl<T> UnwindSafe for IndexBlock<T>where
PhantomData<T>: 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more