[][src]Struct hopscotch::IterMut

pub struct IterMut<'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 mutable references to items in a queue. Created by Queue::iter_mut.

Implementations

impl<'a, 'b, K, V, T, P> IterMut<'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) -> IterMut<'a, 'b, K, V, T, P>[src]

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

Examples

use hopscotch::Queue;

let mut queue: Queue<usize, usize> = (0..=3).zip(0..=3).collect();
for mut item in queue.iter_mut().after(2) {
   *item.value_mut() *= 1000;
}
let vec: Vec<_> = queue.iter().map(|i| *i.value()).collect();
assert_eq!(&vec, &[0, 1, 2000, 3000]);

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

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

Examples

use hopscotch::Queue;

let mut queue: Queue<usize, usize> = (0..=3).zip(0..=3).collect();
for mut item in queue.iter_mut().until(1) {
   *item.value_mut() += 1000;
}
let vec: Vec<_> = queue.iter().map(|i| *i.value()).collect();
assert_eq!(&vec, &[1000, 1001, 2, 3]);

pub fn matching_only<Tags>(
    self,
    tags: Tags
) -> IterMut<'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 mut queue: Queue<usize, usize> =
    [0, 1, 0, 1].iter().copied().zip(0..=3).collect();
for mut item in queue.iter_mut().matching_only(&[1]) {
   *item.value_mut() *= 1000;
}
let vec: Vec<_> = queue.iter().map(|i| *i.value()).collect();
assert_eq!(&vec, &[0, 1000, 2, 3000]);

Trait Implementations

impl<'a, 'b, K, V, Tags, P> DoubleEndedIterator for IterMut<'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 IterMut<'a, 'b, K, V, Tags, P> where
    P: SharedPointerKind,
    K: Ord + Clone + 'b,
    Tags: Iterator<Item = &'b K> + Clone
[src]

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

The type of the elements being iterated over.

Auto Trait Implementations

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

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

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

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

impl<'a, 'b, K, V, Tags, P = RcK> !UnwindSafe for IterMut<'a, 'b, K, V, Tags, P>

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, 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.