Struct lfchring::Iter[][src]

pub struct Iter<'guard, N: ?Sized, H> where
    N: Node,
    H: Hasher
{ /* fields omitted */ }

An iterator over the VirtualNodes of a HashRing<N, H>.

This type implements the Iterator trait, as well as the DoubleEndedIterator, ExactSizeIterator and FusedIterator, hence also enabling traversals of the virtual nodes of the consistent hashing ring in a reversed order, acquiring the iterator’s length, etc.

Iter is constructed through calls to HashRing::iter. However, note that the IntoIterator trait is not implemented because of a deviation in the method’s signature:

Iter is generic over the lifetime of a Guard, which is required to ensure that the underlying pointer to the original data structure where the virtual nodes have been stored since the time of the creation of the iterator is not being freed by some subsequent write operation on the ring. The Guard must be created by the user of the iterator and passed to the Iter through the HashRing::iter call. For further information regarding the memory management techniques employed by this crate, please refer to the crate-level documentation, as well as the documentation of crossbeam_epoch.

Also note that for the same reasons as above, Iter cannot be Send or Sync, as the deallocation of the data pointed to internally by the Iter effectively awaits the thread that constructed the Iter to get unpinned.

Trait Implementations

impl<'guard, N: ?Sized, H> DoubleEndedIterator for Iter<'guard, N, H> where
    N: Node,
    H: Hasher
[src]

impl<'guard, N: ?Sized, H> ExactSizeIterator for Iter<'guard, N, H> where
    N: Node,
    H: Hasher
[src]

impl<'guard, N: Node + ?Sized, H: Hasher> FusedIterator for Iter<'guard, N, H>[src]

impl<'guard, N: ?Sized, H> Iterator for Iter<'guard, N, H> where
    N: Node,
    H: Hasher
[src]

type Item = &'guard VirtualNode<N>

The type of the elements being iterated over.

Auto Trait Implementations

impl<'guard, N: ?Sized, H> RefUnwindSafe for Iter<'guard, N, H> where
    H: RefUnwindSafe,
    N: RefUnwindSafe

impl<'guard, N, H> !Send for Iter<'guard, N, H>

impl<'guard, N, H> !Sync for Iter<'guard, N, H>

impl<'guard, N: ?Sized, H> Unpin for Iter<'guard, N, H>

impl<'guard, N: ?Sized, H> UnwindSafe for Iter<'guard, N, H> where
    H: RefUnwindSafe,
    N: RefUnwindSafe

Blanket Implementations

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

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

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

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> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

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.