Struct hash_rings::carp::Node [−][src]
pub struct Node<'a, T> where
T: 'a, { /* fields omitted */ }
A node with an associated weight.
The distribution of points to nodes is proportional to the weights of the nodes. For example, a node with a weight of 3 will receive approximately three times more points than a node with a weight of 1.
Methods
impl<'a, T> Node<'a, T> where
T: Hash,
[src]
impl<'a, T> Node<'a, T> where
T: Hash,
pub fn new(id: &'a T, weight: f64) -> Self
[src]
pub fn new(id: &'a T, weight: f64) -> Self
Constructs a new node with a particular weight associated with it.
Examples
use hash_rings::carp::{Node, Ring}; let node = Node::new(&"node-1", 1f64);