Expand description
A radix tree
Implementations
sourceimpl RadixTree
impl RadixTree
pub fn get(&self, key: impl AsRef<[u8]>) -> Option<Value>
pub fn contains_key(&self, key: impl AsRef<[u8]>) -> bool
pub fn has_prefix(&self, prefix: impl AsRef<[u8]>) -> bool
pub fn remove_prefix(&mut self, prefix: impl AsRef<[u8]>)
pub fn insert(&mut self, key: impl AsRef<[u8]>, value: impl AsRef<[u8]>)
pub fn remove(&mut self, key: impl AsRef<[u8]>)
pub fn iter(&self) -> impl Iterator<Item = (IterKey, Value)>
pub fn values(&self) -> impl Iterator<Item = Value>
pub fn scan_prefix(
&self,
prefix: impl AsRef<[u8]>
) -> impl Iterator<Item = (IterKey, Value)> + '_
pub fn group_by<'a>(
&'a self,
f: impl Fn(&[u8], &TreeNodeRef<'_>) -> bool + 'a
) -> impl Iterator<Item = RadixTree> + 'a
pub fn dump(&self)
pub fn outer_combine(
&self,
that: &RadixTree,
f: impl Fn(&ValueRef<'_>, &ValueRef<'_>) -> Option<Value> + Copy
) -> RadixTree
pub fn inner_combine(
&self,
that: &RadixTree,
f: impl Fn(&ValueRef<'_>, &ValueRef<'_>) -> Option<Value> + Copy
) -> RadixTree
pub fn inner_combine_pred(
&self,
that: &RadixTree,
f: impl Fn(&ValueRef<'_>, &ValueRef<'_>) -> bool + Copy
) -> bool
pub fn left_combine(
&self,
that: &RadixTree,
f: impl Fn(&ValueRef<'_>, &ValueRef<'_>) -> Option<Value> + Copy
) -> RadixTree
pub fn left_combine_pred(
&self,
that: &RadixTree,
f: impl Fn(&ValueRef<'_>, &ValueRef<'_>) -> bool + Copy
) -> bool
pub fn first_value(&self) -> Option<Value>
pub fn last_value(&self) -> Option<Value>
pub fn first_entry(&self, prefix: Vec<u8>) -> Option<(Vec<u8>, Value)>
pub fn last_entry(&self, prefix: Vec<u8>) -> Option<(Vec<u8>, Value)>
sourceimpl RadixTree
impl RadixTree
pub fn leaf(value: impl AsRef<[u8]>) -> Self
pub fn single(key: impl AsRef<[u8]>, value: impl AsRef<[u8]>) -> Self
pub fn outer_combine_with<S2: BlobStore<Error = NoError> + Clone>(
&mut self,
that: &RadixTree<S2>,
f: impl Fn(&mut Value, &ValueRef<'_, S2>) + Copy
)
pub fn inner_combine_with<S2: BlobStore<Error = NoError> + Clone>(
&mut self,
that: &RadixTree<S2>,
f: impl Fn(&mut Value, &ValueRef<'_, S2>) + Copy
)
pub fn left_combine_with<S2: BlobStore<Error = NoError> + Clone>(
&mut self,
that: &RadixTree<S2>,
f: impl Fn(&mut Value, &ValueRef<'_, S2>) + Copy
)
pub fn filter_prefix(
&self,
prefix: impl AsRef<[u8]>,
substitution: impl AsRef<[u8]>
) -> RadixTree
pub fn retain_prefix_with<S2: BlobStore<Error = NoError> + Clone>(
&mut self,
that: &RadixTree<S2>,
f: impl Fn(&ValueRef<'_, S2>) -> bool + Copy
)
pub fn remove_prefix_with<S2: BlobStore<Error = NoError> + Clone>(
&mut self,
that: &RadixTree<S2>,
f: impl Fn(&ValueRef<'_, S2>) -> bool + Copy
)
sourceimpl<S: BlobStore> RadixTree<S>
impl<S: BlobStore> RadixTree<S>
pub fn empty(store: S) -> Self
pub fn try_load(store: S, id: Option<impl AsRef<[u8]>>) -> Result<Self, S::Error>
pub fn store(this: &Self) -> &S
pub fn is_empty(&self) -> bool
pub fn is_leaf(&self) -> bool
pub fn value(&self) -> Option<ValueRef<'_, S>>
pub fn prefix(&self) -> ValueRef<'_, S>
sourceimpl<S: BlobStore + Clone> RadixTree<S>
impl<S: BlobStore + Clone> RadixTree<S>
pub fn try_dump(&self) -> Result<(), S::Error>
pub fn try_detached(&self) -> Result<RadixTree, S::Error>
sourcepub fn try_get(
&self,
key: impl AsRef<[u8]>
) -> Result<Option<Value<S>>, S::Error>
pub fn try_get(
&self,
key: impl AsRef<[u8]>
) -> Result<Option<Value<S>>, S::Error>
Get the value for a given key
sourcepub fn try_contains_key(&self, key: impl AsRef<[u8]>) -> Result<bool, S::Error>
pub fn try_contains_key(&self, key: impl AsRef<[u8]>) -> Result<bool, S::Error>
True if key is contained in this set
sourcepub fn try_has_prefix(&self, prefix: impl AsRef<[u8]>) -> Result<bool, S::Error>
pub fn try_has_prefix(&self, prefix: impl AsRef<[u8]>) -> Result<bool, S::Error>
True if there are keys at or below the given prefix
pub fn try_remove_prefix(
&mut self,
prefix: impl AsRef<[u8]>
) -> Result<(), S::Error>
pub fn try_insert(
&mut self,
key: impl AsRef<[u8]>,
value: impl AsRef<[u8]>
) -> Result<(), S::Error>
pub fn try_remove(&mut self, key: impl AsRef<[u8]>) -> Result<(), S::Error>
pub fn try_iter(&self) -> KeyValueIter<S>ⓘNotable traits for KeyValueIter<S>impl<S: BlobStore> Iterator for KeyValueIter<S> type Item = Result<(IterKey, Value<S>), S::Error>;
pub fn try_values(&self) -> ValueIter<S>ⓘNotable traits for ValueIter<S>impl<S: BlobStore> Iterator for ValueIter<S> type Item = Result<Value<S>, S::Error>;
pub fn try_scan_prefix(
&self,
prefix: impl AsRef<[u8]>
) -> Result<KeyValueIter<S>, S::Error>
pub fn try_group_by<'a, F: Fn(&[u8], &TreeNodeRef<'_, S>) -> Result<bool, S::Error> + 'a>(
&'a self,
descend: F
) -> impl Iterator<Item = Result<RadixTree<S>, S::Error>> + 'a
pub fn try_outer_combine<S2, E, F>(
&self,
that: &RadixTree<S2>,
f: F
) -> Result<RadixTree, E>where
S2: BlobStore + Clone,
E: From<S2::Error> + From<S::Error>,
F: Fn(&ValueRef<'_, S>, &ValueRef<'_, S2>) -> Result<Option<Value>, E> + Copy,
pub fn try_outer_combine_with<S2, C, F>(
&mut self,
that: &RadixTree<S2>,
c: C,
f: F
) -> Result<(), S::Error>where
S2: BlobStore + Clone,
C: NodeConverter<S2, S> + Clone,
F: Fn(&mut Value<S>, &ValueRef<'_, S2>) -> Result<(), S::Error> + Copy,
S::Error: From<S2::Error> + From<NoError>,
pub fn try_inner_combine<S2, E, F>(
&self,
that: &RadixTree<S2>,
f: F
) -> Result<RadixTree, E>where
S2: BlobStore + Clone,
E: From<S2::Error> + From<S::Error>,
F: Fn(&ValueRef<'_, S>, &ValueRef<'_, S2>) -> Result<Option<Value>, E> + Copy,
pub fn try_inner_combine_with<S2, C, F>(
&mut self,
that: &RadixTree<S2>,
c: C,
f: F
) -> Result<(), S::Error>where
S2: BlobStore + Clone,
C: NodeConverter<S2, S> + Clone,
F: Fn(&mut Value<S>, &ValueRef<'_, S2>) -> Result<(), S::Error> + Copy,
S::Error: From<S2::Error> + From<NoError>,
pub fn try_inner_combine_pred<S2, E, F>(
&self,
that: &RadixTree<S2>,
f: F
) -> Result<bool, E>where
S2: BlobStore + Clone,
E: From<S::Error> + From<S2::Error>,
F: Fn(&ValueRef<'_, S>, &ValueRef<'_, S2>) -> Result<bool, E> + Copy,
pub fn try_left_combine<S2, E, F>(
&self,
that: &RadixTree<S2>,
f: F
) -> Result<RadixTree, E>where
S2: BlobStore + Clone,
E: From<S2::Error> + From<S::Error>,
F: Fn(&ValueRef<'_, S>, &ValueRef<'_, S2>) -> Result<Option<Value>, E> + Copy,
pub fn try_left_combine_pred<S2, E, F>(
&self,
that: &RadixTree<S2>,
f: F
) -> Result<bool, E>where
S2: BlobStore + Clone,
E: From<S::Error> + From<S2::Error>,
F: Fn(&ValueRef<'_, S>, &ValueRef<'_, S2>) -> Result<bool, E> + Copy,
pub fn try_left_combine_with<S2, C, F>(
&mut self,
that: &RadixTree<S2>,
c: C,
f: F
) -> Result<(), S::Error>where
S2: BlobStore + Clone,
C: NodeConverter<S2, S> + Clone,
F: Fn(&mut Value<S>, &ValueRef<'_, S2>) -> Result<(), S::Error> + Copy,
S::Error: From<S2::Error> + From<NoError>,
pub fn try_retain_prefix_with<S2, F>(
&mut self,
that: &RadixTree<S2>,
f: F
) -> Result<(), S::Error>where
S2: BlobStore + Clone,
F: Fn(&ValueRef<'_, S2>) -> Result<bool, S::Error> + Copy,
S::Error: From<S2::Error> + From<NoError>,
pub fn try_remove_prefix_with<S2, F>(
&mut self,
that: &RadixTree<S2>,
f: F
) -> Result<(), S::Error>where
S2: BlobStore + Clone,
F: Fn(&ValueRef<'_, S2>) -> Result<bool, S::Error> + Copy,
S::Error: From<S2::Error> + From<NoError>,
pub fn try_filter_prefix(
&self,
prefix: impl AsRef<[u8]>,
substitution: impl AsRef<[u8]>
) -> Result<RadixTree<S>, S::Error>
pub fn try_first_value(&self) -> Result<Option<Value<S>>, S::Error>
pub fn try_last_value(&self) -> Result<Option<Value<S>>, S::Error>
pub fn try_first_entry(
&self,
prefix: Vec<u8>
) -> Result<Option<(Vec<u8>, Value<S>)>, S::Error>
pub fn try_last_entry(
&self,
prefix: Vec<u8>
) -> Result<Option<(Vec<u8>, Value<S>)>, S::Error>
Trait Implementations
sourceimpl<K: AsRef<[u8]>, V: AsRef<[u8]>> FromIterator<(K, V)> for RadixTree
impl<K: AsRef<[u8]>, V: AsRef<[u8]>> FromIterator<(K, V)> for RadixTree
sourcefn from_iter<T: IntoIterator<Item = (K, V)>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = (K, V)>>(iter: T) -> Self
Creates a value from an iterator. Read more
impl Eq for RadixTree
Auto Trait Implementations
impl<S> RefUnwindSafe for RadixTree<S>where
S: RefUnwindSafe,
impl<S> Send for RadixTree<S>
impl<S> Sync for RadixTree<S>
impl<S> Unpin for RadixTree<S>where
S: Unpin,
impl<S> UnwindSafe for RadixTree<S>where
S: UnwindSafe + RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more