[−][src]Struct rendezvous_hash::RendezvousNodes
A candidate node set of a rendezvous for clients that are requiring the same item.
Methods
impl<N, H> RendezvousNodes<N, H> where
N: Node,
H: NodeHasher<N::NodeId>,
[src]
N: Node,
H: NodeHasher<N::NodeId>,
pub fn new(hasher: H) -> Self
[src]
Makes a new RendezvousNodes
instance.
ⓘImportant traits for Candidates<'a, N>pub fn calc_candidates<T: Hash>(&mut self, item: &T) -> Candidates<N>
[src]
Returns the candidate nodes for item
.
The higher priority node is located in front of the returned candidate sequence.
Note that this method takes O(n log n)
steps
(where n
is the return value of self.len()
).
pub fn calc_candidates_immut<T: Hash>(
&self,
item: &T
) -> impl Iterator<Item = &N>
[src]
&self,
item: &T
) -> impl Iterator<Item = &N>
Returns the candidate nodes for item
.
The higher priority node is located in front of the returned candidate sequence.
Note that this method takes O(n log n)
steps
(where n
is the return value of self.len()
).
This is equivalent to calc_candidates
method except this allocates
n * (size_of<usize>() + size_of<N::HashCode>())
memory internally.
impl<N: Node, H> RendezvousNodes<N, H>
[src]
pub fn insert(&mut self, node: N) -> Option<N>
[src]
Inserts a new candidate node.
If a node which has an identifier equal to node
exists,
it will be removed and returned as Some(N)
.
pub fn remove<M>(&mut self, node_id: &M) -> Option<N> where
N::NodeId: Borrow<M>,
M: PartialEq,
[src]
N::NodeId: Borrow<M>,
M: PartialEq,
Removes the specified node from the candidates.
If the node does not exist, this method will return None
.
pub fn contains<M>(&self, node_id: &M) -> bool where
N::NodeId: Borrow<M>,
M: PartialEq,
[src]
N::NodeId: Borrow<M>,
M: PartialEq,
Returns true
if the specified node exists in this candidate set, otherwise false
.
pub fn is_empty(&self) -> bool
[src]
Returns true
if there are no candidate nodes.
pub fn len(&self) -> usize
[src]
Returns the count of the candidate nodes.
ⓘImportant traits for Iter<'a, T>pub fn iter(&self) -> Iter<N>
[src]
Returns an iterator over the nodes of this candidate set.
Trait Implementations
impl<N: Node, H> Extend<N> for RendezvousNodes<N, H>
[src]
fn extend<T>(&mut self, iter: T) where
T: IntoIterator<Item = N>,
[src]
T: IntoIterator<Item = N>,
impl<N: Node> Default for RendezvousNodes<N, DefaultNodeHasher>
[src]
impl<N: Node, H> IntoIterator for RendezvousNodes<N, H>
[src]
Auto Trait Implementations
impl<N, H> Send for RendezvousNodes<N, H> where
H: Send,
N: Send,
<N as Node>::HashCode: Send,
H: Send,
N: Send,
<N as Node>::HashCode: Send,
impl<N, H> Sync for RendezvousNodes<N, H> where
H: Sync,
N: Sync,
<N as Node>::HashCode: Sync,
H: Sync,
N: Sync,
<N as Node>::HashCode: Sync,
impl<N, H> Unpin for RendezvousNodes<N, H> where
H: Unpin,
N: Unpin,
<N as Node>::HashCode: Unpin,
H: Unpin,
N: Unpin,
<N as Node>::HashCode: Unpin,
impl<N, H> RefUnwindSafe for RendezvousNodes<N, H> where
H: RefUnwindSafe,
N: RefUnwindSafe,
<N as Node>::HashCode: RefUnwindSafe,
H: RefUnwindSafe,
N: RefUnwindSafe,
<N as Node>::HashCode: RefUnwindSafe,
impl<N, H> UnwindSafe for RendezvousNodes<N, H> where
H: UnwindSafe,
N: UnwindSafe,
<N as Node>::HashCode: UnwindSafe,
H: UnwindSafe,
N: UnwindSafe,
<N as Node>::HashCode: UnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,