Enum dusk_kelvin_map::KelvinMap [−][src]
pub enum KelvinMap<K, V, A> where
K: Canon + Ord,
V: Canon,
A: MapAnnotation<K, V>, { Empty, Leaf(Leaf<K, V>), Node(Annotated<KelvinMap<K, V, A>, A>, Annotated<KelvinMap<K, V, A>, A>), }
Binary tree map-like implementation with Microkelvin set as backend
The borrowed [Max
] from the annotation will be used to traverse the tree and is expected to
be the maximum K
contained in that sub-tree.
Variants
Represents and empty endpoint
Leaf(Leaf<K, V>)
Leaf of the tree containing a key -> value mapping
Annotated node that will contain, at least, the maximum key value that exists within this sub-tree
Implementations
impl<K, V, A> KelvinMap<K, V, A> where
K: Canon + Ord,
V: Canon,
A: MapAnnotation<K, V>,
[src]
impl<K, V, A> KelvinMap<K, V, A> where
K: Canon + Ord,
V: Canon,
A: MapAnnotation<K, V>,
[src]pub fn get<'a>(
&'a self,
k: &K
) -> Result<Option<impl Deref<Target = V> + 'a>, CanonError>
[src]
pub fn get<'a>(
&'a self,
k: &K
) -> Result<Option<impl Deref<Target = V> + 'a>, CanonError>
[src]Returns a reference to the value corresponding to the key
Will return Ok(None)
if no correspondent key was found.
pub fn get_mut<'a>(
&'a mut self,
k: &K
) -> Result<Option<impl DerefMut<Target = V> + 'a>, CanonError>
[src]
pub fn get_mut<'a>(
&'a mut self,
k: &K
) -> Result<Option<impl DerefMut<Target = V> + 'a>, CanonError>
[src]Returns a mutable reference to the value corresponding to the key
Will return Ok(None)
if no correspondent key was found.
pub fn remove(&mut self, k: &K) -> Result<Option<V>, CanonError>
[src]
pub fn remove(&mut self, k: &K) -> Result<Option<V>, CanonError>
[src]Remove a key -> value mapping from the set.
If the key was previously mapped, it will return the old value in the form Ok(Some(V))
.
If the key was not previously mapped, the return will be Ok(None)
. This operation is
idempotent.
Internally, a naive balancing will be performed. If the tree contains more elements on the left, it will move the maximum key of the left to the right - and vice-versa.
pub fn insert(&mut self, k: K, v: V) -> Result<Option<V>, CanonError>
[src]
pub fn insert(&mut self, k: K, v: V) -> Result<Option<V>, CanonError>
[src]Include a key -> value mapping to the set.
If the key was previously mapped, it will return the old value in the form Ok(Some(V))
.
If the key was not previously mapped, the return will be Ok(None)
Internally, a naive balancing will be performed. If the tree contains more elements on the left, it will move the maximum key of the left to the right - and vice-versa.
Trait Implementations
impl<K: Canon, V: Canon, A: Canon> Canon for KelvinMap<K, V, A> where
K: Canon + Ord,
V: Canon,
A: MapAnnotation<K, V>,
[src]
impl<K: Canon, V: Canon, A: Canon> Canon for KelvinMap<K, V, A> where
K: Canon + Ord,
V: Canon,
A: MapAnnotation<K, V>,
[src]impl<K: Clone, V: Clone, A: Clone> Clone for KelvinMap<K, V, A> where
K: Canon + Ord,
V: Canon,
A: MapAnnotation<K, V>,
[src]
impl<K: Clone, V: Clone, A: Clone> Clone for KelvinMap<K, V, A> where
K: Canon + Ord,
V: Canon,
A: MapAnnotation<K, V>,
[src]impl<K, V> Combine<KelvinMap<K, V, MapAnnotationDefault<K>>, MapAnnotationDefault<K>> for MapAnnotationDefault<K> where
K: Canon + Ord + Default,
V: Canon,
[src]
impl<K, V> Combine<KelvinMap<K, V, MapAnnotationDefault<K>>, MapAnnotationDefault<K>> for MapAnnotationDefault<K> where
K: Canon + Ord + Default,
V: Canon,
[src]fn combine(node: &KelvinMap<K, V, MapAnnotationDefault<K>>) -> Self
[src]
fn combine(node: &KelvinMap<K, V, MapAnnotationDefault<K>>) -> Self
[src]Combines multiple annotations
impl<K, V, A> Compound<A> for KelvinMap<K, V, A> where
V: Canon,
K: Canon + Ord,
A: MapAnnotation<K, V>,
[src]
impl<K, V, A> Compound<A> for KelvinMap<K, V, A> where
V: Canon,
K: Canon + Ord,
A: MapAnnotation<K, V>,
[src]Auto Trait Implementations
impl<K, V, A> !RefUnwindSafe for KelvinMap<K, V, A>
impl<K, V, A> !Send for KelvinMap<K, V, A>
impl<K, V, A> !Sync for KelvinMap<K, V, A>
impl<K, V, A> Unpin for KelvinMap<K, V, A> where
K: Unpin,
V: Unpin,
K: Unpin,
V: Unpin,
impl<K, V, A> !UnwindSafe for KelvinMap<K, V, A>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> EncodeToVec for T where
T: Canon,
[src]
impl<T> EncodeToVec for T where
T: Canon,
[src]pub fn encode_to_vec(&self) -> Vec<u8, Global>
[src]
pub fn encode_to_vec(&self) -> Vec<u8, Global>
[src]Encode Self
into a buffer
impl<'a, C, A> First<'a, A> for C where
C: Compound<A> + Clone,
A: Combine<C, A>,
[src]
impl<'a, C, A> First<'a, A> for C where
C: Compound<A> + Clone,
A: Combine<C, A>,
[src]pub fn first(&'a self) -> Result<Option<Branch<'a, C, A>>, CanonError>
[src]
pub fn first(&'a self) -> Result<Option<Branch<'a, C, A>>, CanonError>
[src]Construct a Branch
pointing to the first element, if not empty
pub fn first_mut(
&'a mut self
) -> Result<Option<BranchMut<'a, C, A>>, CanonError> where
C: MutableLeaves,
A: Combine<C, A>,
[src]
pub fn first_mut(
&'a mut self
) -> Result<Option<BranchMut<'a, C, A>>, CanonError> where
C: MutableLeaves,
A: Combine<C, A>,
[src]Construct a BranchMut
pointing to the first element, if not empty
impl<'a, C, A, K> GetMaxKey<'a, A, K> for C where
C: Compound<A> + Clone,
K: Ord + Clone + Debug,
A: Combine<C, A> + Borrow<MaxKey<K>>,
<C as Compound<A>>::Leaf: Keyed<K>,
[src]
impl<'a, C, A, K> GetMaxKey<'a, A, K> for C where
C: Compound<A> + Clone,
K: Ord + Clone + Debug,
A: Combine<C, A> + Borrow<MaxKey<K>>,
<C as Compound<A>>::Leaf: Keyed<K>,
[src]pub fn max_key(&'a self) -> Result<Option<Branch<'a, C, A>>, CanonError>
[src]
pub fn max_key(&'a self) -> Result<Option<Branch<'a, C, A>>, CanonError>
[src]Construct a Branch
pointing to the element with the largest key
pub fn max_key_mut(
&'a mut self
) -> Result<Option<BranchMut<'a, C, A>>, CanonError> where
C: MutableLeaves,
A: Combine<C, A>,
[src]
pub fn max_key_mut(
&'a mut self
) -> Result<Option<BranchMut<'a, C, A>>, CanonError> where
C: MutableLeaves,
A: Combine<C, A>,
[src]Construct a BranchMut
pointing to the element with the largest key
impl<'a, C, A> Nth<'a, A> for C where
C: Compound<A> + Clone,
A: Combine<C, A> + Borrow<Cardinality>,
[src]
impl<'a, C, A> Nth<'a, A> for C where
C: Compound<A> + Clone,
A: Combine<C, A> + Borrow<Cardinality>,
[src]pub fn nth(&'a self, ofs: u64) -> Result<Option<Branch<'a, C, A>>, CanonError>
[src]
pub fn nth(&'a self, ofs: u64) -> Result<Option<Branch<'a, C, A>>, CanonError>
[src]Construct a Branch
pointing to the nth
element, if any
pub fn nth_mut(
&'a mut self,
ofs: u64
) -> Result<Option<BranchMut<'a, C, A>>, CanonError> where
C: MutableLeaves,
A: Combine<C, A>,
[src]
pub fn nth_mut(
&'a mut self,
ofs: u64
) -> Result<Option<BranchMut<'a, C, A>>, CanonError> where
C: MutableLeaves,
A: Combine<C, A>,
[src]Construct a BranchMut
pointing to the nth
element, if any
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more