[−][src]Struct hat_trie::DenseVecTrieNode
A type of Trie that implemented by using Vec index as encoded key.
Care should be taken before using this Trie.
The memory requirement for this Trie is equals to bits of key. For example, if key is of type &u8, each layer of Trie will need at least 2^8 * 4 bytes (1024 bytes) + all other meta such as minimum and maximum length of stored key, threshold for burst/split, etc. If key is of type &u32, each layer will need 2^32 * 4 bytes (16GB).
Implementations
impl<K, V> DenseVecTrieNode<K, V> where
K: Copy + AsPrimitive<usize> + Bounded + Debug + Hash + FromPrimitive + PartialEq + PartialOrd + Sized + Unsigned,
Box<[K]>: Clone + PartialEq,
V: Clone + Debug + Default,
[src]
K: Copy + AsPrimitive<usize> + Bounded + Debug + Hash + FromPrimitive + PartialEq + PartialOrd + Sized + Unsigned,
Box<[K]>: Clone + PartialEq,
V: Clone + Debug + Default,
pub fn new() -> DenseVecTrieNode<K, V>
[src]
Create new empty DenseVecTrieNode.
It will automatically expand into larger trie by append necesseary child type to maintain it fitness. This method return default configuration for the DenseVecTrieNode.
pub fn with_spec(
threshold: usize,
init_bucket_size: usize,
init_bucket_slots: usize,
bucket_load_factor: usize
) -> DenseVecTrieNode<K, V>
[src]
threshold: usize,
init_bucket_size: usize,
init_bucket_slots: usize,
bucket_load_factor: usize
) -> DenseVecTrieNode<K, V>
Create new empty DenseVecTrieNode.
It will automatically expand into larger trie by append necesseary child type to maintain it fitness. This method take specifications which this trie should maintain in order to fit with expected performance.
Parameters
threshold
- The number of element in each leaf container which if exceed will cause node
burst/split depending on type of node at that moment.
init_bucket_size
- The initial size of bucket. Bucket is a container used in leaf node.
This number shall be large enough to have only few data in each slot in bucket but it shall
also be small enough to fit into single page of memory for caching reason.
init_bucket_slots
- The initial size of each slot which will store actual data. It will grow if
there is a lot of hash collision.
bucket_load_factor
- The number of element in bucket which if reached, will expand the bucket size
by 2 times of current size.
Return
A trie instance of type DenseVecTrieNode
Trait Implementations
impl<K: Clone, V: Clone> Clone for DenseVecTrieNode<K, V> where
K: AsPrimitive<usize> + Bounded + Copy + Debug + Hash + FromPrimitive + PartialEq + PartialOrd + Sized + Unsigned,
Box<[K]>: Clone + PartialEq,
V: Clone + Debug + Default,
[src]
K: AsPrimitive<usize> + Bounded + Copy + Debug + Hash + FromPrimitive + PartialEq + PartialOrd + Sized + Unsigned,
Box<[K]>: Clone + PartialEq,
V: Clone + Debug + Default,
fn clone(&self) -> DenseVecTrieNode<K, V>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<K: Debug, V: Debug> Debug for DenseVecTrieNode<K, V> where
K: AsPrimitive<usize> + Bounded + Copy + Debug + Hash + FromPrimitive + PartialEq + PartialOrd + Sized + Unsigned,
Box<[K]>: Clone + PartialEq,
V: Clone + Debug + Default,
[src]
K: AsPrimitive<usize> + Bounded + Copy + Debug + Hash + FromPrimitive + PartialEq + PartialOrd + Sized + Unsigned,
Box<[K]>: Clone + PartialEq,
V: Clone + Debug + Default,
impl<K, V> TrieNode<K, V> for DenseVecTrieNode<K, V> where
K: AsPrimitive<usize> + Bounded + Copy + Debug + Hash + FromPrimitive + PartialEq + PartialOrd + Sized + Unsigned,
Box<[K]>: Clone + PartialEq,
V: Clone + Debug + Default,
[src]
K: AsPrimitive<usize> + Bounded + Copy + Debug + Hash + FromPrimitive + PartialEq + PartialOrd + Sized + Unsigned,
Box<[K]>: Clone + PartialEq,
V: Clone + Debug + Default,
fn new_split(bucket: ArrayHash<XxHash64, Box<[K]>, V>, threshold: usize) -> Self
[src]
fn child<'a>(&'a self, key: &K) -> &'a NodeType<K, Self, V>
[src]
fn value(&self) -> Option<&V>
[src]
fn value_mut(&mut self) -> &mut Option<V>
[src]
fn put(&mut self, key: &[K], value: V) -> Option<V>
[src]
fn try_put<'a>(&'a mut self, key: &[K], value: V) -> Option<&'a V> where
K: 'a,
[src]
K: 'a,
fn max_key_len(&self) -> usize
[src]
fn min_key_len(&self) -> usize
[src]
fn get<'a>(&'a self, key: &[K]) -> Option<&'a V> where
K: 'a,
[src]
K: 'a,
fn prefix<'a, 'b>(&'a self, key: &'b [K]) -> PrefixIterator<'a, 'b, K, Self, V>
[src]
fn longest_prefix<'a, 'b>(&'a self, key: &'b [K]) -> Option<(&'b [K], &'a V)> where
K: 'a,
[src]
K: 'a,
Auto Trait Implementations
impl<K, V> RefUnwindSafe for DenseVecTrieNode<K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for DenseVecTrieNode<K, V> where
V: Send,
V: Send,
impl<K, V> !Sync for DenseVecTrieNode<K, V>
impl<K, V> Unpin for DenseVecTrieNode<K, V> where
K: Unpin,
V: Unpin,
K: Unpin,
V: Unpin,
impl<K, V> UnwindSafe for DenseVecTrieNode<K, V> where
K: RefUnwindSafe + UnwindSafe,
V: RefUnwindSafe + UnwindSafe,
K: RefUnwindSafe + UnwindSafe,
V: RefUnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,