[][src]Struct rendezvous_hash::RendezvousNodes

pub struct RendezvousNodes<N: Node, H> { /* fields omitted */ }

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]

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]

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]

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]

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]

impl<N: Node> Default for RendezvousNodes<N, DefaultNodeHasher>[src]

impl<N: Node, H> IntoIterator for RendezvousNodes<N, H>[src]

type Item = N

The type of the elements being iterated over.

type IntoIter = IntoIter<N>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl<N, H> Send for RendezvousNodes<N, H> where
    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

impl<N, H> Unpin for RendezvousNodes<N, H> where
    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

impl<N, H> UnwindSafe for RendezvousNodes<N, H> where
    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]

impl<I> IntoIterator for I where
    I: Iterator
[src]

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?

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> Borrow<T> for T where
    T: ?Sized
[src]

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

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