[][src]Struct hopscotch::Iter

pub struct Iter<'a, 'b, K, V, Tags, S = RandomState> where
    K: Eq + Hash + Clone + 'b,
    Tags: Iterator<Item = &'b K> + Clone
{ /* fields omitted */ }

An iterator over immutable references to items in a queue.

Methods

impl<'a, 'b, K, V, T, S> Iter<'a, 'b, K, V, T, S> where
    K: Eq + Hash + Clone + 'b,
    T: Iterator<Item = &'b K> + Clone
[src]

pub fn after(self, earliest: u64) -> Iter<'a, 'b, K, V, T, S>[src]

Restrict this iterator to indices greater than or equal to earliest.

Examples

use hopscotch::Queue;

let queue: Queue<usize, usize> = (0..=3).zip(0..=3).collect();
let vec: Vec<_> = queue.iter().after(2).map(|i| *i.value()).collect();
assert_eq!(&vec, &[2, 3]);

pub fn until(self, latest: u64) -> Iter<'a, 'b, K, V, T, S>[src]

Restrict this iterator to indices less than or equal to latest.

Examples

use hopscotch::Queue;

let queue: Queue<usize, usize> = (0..=3).zip(0..=3).collect();
let vec: Vec<_> = queue.iter().until(1).map(|i| *i.value()).collect();
assert_eq!(&vec, &[0, 1]);

pub fn matching_only<Tags>(
    self,
    tags: Tags
) -> Iter<'a, 'b, K, V, Tags::IntoIter, S> where
    Tags: IntoIterator<Item = &'b K>,
    Tags::IntoIter: Clone
[src]

Restrict this iterator to tags in the given list of tags.

This has the same efficiency characteristics as the before and after methods: each item is produced in constant time relative to the distance between matching tags.

If matching_only is called twice, the set of tags given in the second call completely overrides those given in the first.

Examples

use hopscotch::Queue;

let queue: Queue<usize, usize> =
    [0, 1, 0, 1].iter().copied().zip(0..=3).collect();
let vec: Vec<_> =
    queue.iter().matching_only(&[1]).map(|i| *i.value()).collect();
assert_eq!(&vec, &[1, 3]);

Trait Implementations

impl<'a, 'b, K: Clone, V: Clone, Tags: Clone, S: Clone> Clone for Iter<'a, 'b, K, V, Tags, S> where
    K: Eq + Hash + Clone + 'b,
    Tags: Iterator<Item = &'b K> + Clone
[src]

impl<'a, 'b, K, V, Tags, S> DoubleEndedIterator for Iter<'a, 'b, K, V, Tags, S> where
    K: Eq + Hash + Clone + 'b,
    Tags: Iterator<Item = &'b K> + Clone,
    S: BuildHasher
[src]

impl<'a, 'b, K, V, Tags, S> Iterator for Iter<'a, 'b, K, V, Tags, S> where
    K: Eq + Hash + Clone + 'b,
    Tags: Iterator<Item = &'b K> + Clone,
    S: BuildHasher
[src]

type Item = Item<'a, K, V>

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a, 'b, K, V, Tags, S> RefUnwindSafe for Iter<'a, 'b, K, V, Tags, S> where
    K: RefUnwindSafe,
    S: RefUnwindSafe,
    Tags: RefUnwindSafe,
    V: RefUnwindSafe

impl<'a, 'b, K, V, Tags, S> Send for Iter<'a, 'b, K, V, Tags, S> where
    K: Send + Sync,
    S: Send + Sync,
    Tags: Send,
    V: Sync

impl<'a, 'b, K, V, Tags, S> Sync for Iter<'a, 'b, K, V, Tags, S> where
    K: Send + Sync,
    S: Send + Sync,
    Tags: Sync,
    V: Sync

impl<'a, 'b, K, V, Tags, S> Unpin for Iter<'a, 'b, K, V, Tags, S> where
    Tags: Unpin

impl<'a, 'b, K, V, Tags, S> UnwindSafe for Iter<'a, 'b, K, V, Tags, S> where
    K: RefUnwindSafe,
    S: RefUnwindSafe,
    Tags: UnwindSafe,
    V: 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> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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.