[][src]Struct s_tree::STree

#[non_exhaustive]pub struct STree<K, V>(_);

Implementations

impl<K: Ord, V> STree<K, V>[src]

pub fn new() -> Self[src]

Makes a empty tree

pub fn get(&self, key: K) -> Option<&V>[src]

Returns a reference to the value corresponding to the key

pub fn insert(&mut self, key: K, value: V) -> Option<V>[src]

Inserts a key-value pair into the tree

If the tree did not have this key present, None is returned

pub fn remove(&mut self, key: K) -> Option<V>[src]

Removes a key from the tree, returning the value at the key if the key was previously in the tree

impl<V> STree<u64, V>[src]

pub fn find_best_single(
    &self,
    target: u64,
    common_bits: u32
) -> Option<(u64, &V)>
[src]

Finds the best element by proximity to the target within common bits threshold

pub fn find_best_sorted(&self, target: u64, common_bits: u32) -> Vec<(u64, &V)>[src]

Finds elements within common bits threshold and returns them sorted by proximity to the target, the first one being the closest one

Auto Trait Implementations

impl<K, V> RefUnwindSafe for STree<K, V> where
    K: RefUnwindSafe,
    V: RefUnwindSafe

impl<K, V> Send for STree<K, V> where
    K: Send,
    V: Send

impl<K, V> Sync for STree<K, V> where
    K: Sync,
    V: Sync

impl<K, V> Unpin for STree<K, V> where
    K: Unpin,
    V: Unpin

impl<K, V> UnwindSafe for STree<K, V> where
    K: RefUnwindSafe + UnwindSafe,
    V: RefUnwindSafe + UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.