pub struct Rendezvous<N, S = RandomState> { /* private fields */ }Implementations§
Source§impl<N> Rendezvous<N, RandomState>
impl<N> Rendezvous<N, RandomState>
pub fn from_nodes(nodes: impl IntoIterator<Item = N>) -> Self
Source§impl<N, S> Rendezvous<N, S>
impl<N, S> Rendezvous<N, S>
Sourcepub fn from_nodes_and_hasher(
nodes: impl IntoIterator<Item = N>,
build: S,
) -> Self
pub fn from_nodes_and_hasher( nodes: impl IntoIterator<Item = N>, build: S, ) -> Self
Construct with a custom hasher builder (e.g., ahash::RandomState).
pub fn add_node(&mut self, node: N) -> bool
pub fn remove_node(&mut self, node: &N) -> bool
Sourcepub fn pick_top<K: Hash>(&self, key: &K) -> Option<&N>
pub fn pick_top<K: Hash>(&self, key: &K) -> Option<&N>
Pick the single best node (O(N) max scan).
Sourcepub fn pick_top_k<K: Hash>(&self, key: &K, k: usize) -> Vec<&N>
pub fn pick_top_k<K: Hash>(&self, key: &K, k: usize) -> Vec<&N>
Pick the top-k nodes with partial selection (O(N) + O(k log k))
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl<N: Clone, S: Clone> Clone for Rendezvous<N, S>
impl<N: Clone, S: Clone> Clone for Rendezvous<N, S>
Source§fn clone(&self) -> Rendezvous<N, S>
fn clone(&self) -> Rendezvous<N, S>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<N, S> Freeze for Rendezvous<N, S>where
S: Freeze,
impl<N, S> RefUnwindSafe for Rendezvous<N, S>where
S: RefUnwindSafe,
N: RefUnwindSafe,
impl<N, S> Send for Rendezvous<N, S>
impl<N, S> Sync for Rendezvous<N, S>
impl<N, S> Unpin for Rendezvous<N, S>
impl<N, S> UnsafeUnpin for Rendezvous<N, S>where
S: UnsafeUnpin,
impl<N, S> UnwindSafe for Rendezvous<N, S>where
S: UnwindSafe,
N: 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
Mutably borrows from an owned value. Read more