[][src]Struct hopscotch::Iter

pub struct Iter<'a, 'b, K, V, Tags, P = RcK> where
    P: SharedPointerKind,
    K: Ord + Clone + 'b,
    Tags: Iterator<Item = &'b K> + Clone
{ /* fields omitted */ }

An iterator over immutable references to items in a queue. Created by Queue::iter.

Implementations

impl<'a, 'b, K, V, T, P> Iter<'a, 'b, K, V, T, P> where
    P: SharedPointerKind,
    K: Ord + Clone + 'b,
    T: Iterator<Item = &'b K> + Clone
[src]

pub fn after(self, earliest: u64) -> Iter<'a, 'b, K, V, T, P>[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, P>[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, P> where
    Tags: IntoIterator<Item = &'b K>,
    Tags::IntoIter: Clone
[src]

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

This results in the same efficiency characteristics as the Queue::before and Queue::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, P: Clone> Clone for Iter<'a, 'b, K, V, Tags, P> where
    P: SharedPointerKind,
    K: Ord + Clone + 'b,
    Tags: Iterator<Item = &'b K> + Clone
[src]

impl<'a, 'b, K, V, Tags, P> DoubleEndedIterator for Iter<'a, 'b, K, V, Tags, P> where
    P: SharedPointerKind,
    K: Ord + Clone + 'b,
    Tags: Iterator<Item = &'b K> + Clone
[src]

impl<'a, 'b, K, V, Tags, P> Iterator for Iter<'a, 'b, K, V, Tags, P> where
    P: SharedPointerKind,
    K: Ord + Clone + 'b,
    Tags: Iterator<Item = &'b K> + Clone
[src]

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

The type of the elements being iterated over.

Auto Trait Implementations

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

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

impl<'a, 'b, K, V, Tags, P> Sync for Iter<'a, 'b, K, V, Tags, P> where
    K: Sync,
    P: Sync,
    Tags: Sync,
    V: Sync

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

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