[][src]Struct consistent_hash_ring::RingBuilder

pub struct RingBuilder<T, S = FnvBuildHasher> where
    T: Hash + Eq + Clone,
    S: BuildHasher
{ /* fields omitted */ }

A builder for Ring.

Methods

impl<T: Hash + Eq + Clone, S: BuildHasher> RingBuilder<T, S>[src]

pub fn new(hasher: S) -> Self[src]

Returns a new RingBuilder with the specified BuildHasher.

pub fn vnodes(self, vnodes: usize) -> Self[src]

Specifies the number of vnodes for each node.

The default is 10.

pub fn replicas(self, replicas: usize) -> Self[src]

Specifies the number of replicas for each key.

The default is 1.

pub fn weighted_node(self, node: T, vnodes: usize) -> Self[src]

Ensure that the built Ring contains node with the specified number of vnodes (regardless of the default vnode count).

pub fn weighted_nodes(self, weighted_nodes: &[(T, usize)]) -> Self[src]

Ensure that the built Ring contains all nodes in the provided slice with the associated number of vnodes (regardless of the default vnode count).

pub fn weighted_nodes_iter<I>(self, weighted_nodes: I) -> Self where
    I: Iterator<Item = (T, usize)>, 
[src]

Ensure that the built Ring contains all nodes in the provided iterator with the associated number of vnodes (regardless of the default vnode count).

pub fn node(self, node: T) -> Self[src]

Ensure that the built Ring contains the provided node.

pub fn nodes(self, nodes: &[T]) -> Self[src]

Ensure that the built Ring contains all nodes in the provided slice.

pub fn nodes_iter<I>(self, nodes: I) -> Self where
    I: Iterator<Item = T>, 
[src]

Ensure that the built Ring contains all nodes in the provided iterator.

pub fn build(self) -> Ring<T, S>[src]

Build the Ring.

Trait Implementations

impl<T: Hash + Eq + Clone> Default for RingBuilder<T>[src]

impl<T: Clone, S: Clone> Clone for RingBuilder<T, S> where
    T: Hash + Eq + Clone,
    S: BuildHasher
[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<T, S> Send for RingBuilder<T, S> where
    S: Send,
    T: Send

impl<T, S> Unpin for RingBuilder<T, S> where
    S: Unpin,
    T: Unpin

impl<T, S> Sync for RingBuilder<T, S> where
    S: Sync,
    T: Sync

impl<T, S> UnwindSafe for RingBuilder<T, S> where
    S: UnwindSafe,
    T: UnwindSafe

impl<T, S> RefUnwindSafe for RingBuilder<T, S> where
    S: RefUnwindSafe,
    T: RefUnwindSafe

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

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

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

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