pub struct ConsistentHasher<H: HashSeqBuilder> { /* private fields */ }Expand description
Wrapper around ConsistentHashIterator and ConsistentHashRevIterator to compute
the next or previous consistent hash for a given key for a given number of nodes n.
Implementations§
Source§impl<H: HashSeqBuilder> ConsistentHasher<H>
impl<H: HashSeqBuilder> ConsistentHasher<H>
Sourcepub fn new(builder: H) -> Self
pub fn new(builder: H) -> Self
Construct a new ConsistentHasher with the given builder for a specific key.
Sourcepub fn prev(&self, n: usize) -> Option<usize>where
H: Clone,
pub fn prev(&self, n: usize) -> Option<usize>where
H: Clone,
Return the largest consistent hash smaller than n.
Auto Trait Implementations§
impl<H> Freeze for ConsistentHasher<H>where
H: Freeze,
impl<H> RefUnwindSafe for ConsistentHasher<H>where
H: RefUnwindSafe,
impl<H> Send for ConsistentHasher<H>where
H: Send,
impl<H> Sync for ConsistentHasher<H>where
H: Sync,
impl<H> Unpin for ConsistentHasher<H>where
H: Unpin,
impl<H> UnsafeUnpin for ConsistentHasher<H>where
H: UnsafeUnpin,
impl<H> UnwindSafe for ConsistentHasher<H>where
H: 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