arrayset 3.1.1

An array-backed ordered set type.
Documentation
use core::{iter::FusedIterator, slice};

#[derive(Debug)]
pub struct ValuesMut<'a, V>(slice::IterMut<'a, V>);

impl<'a, V> ValuesMut<'a, V>
where
    V: 'a,
{
    pub(super) fn new(values: &'a mut [V]) -> Self {
        Self(values.iter_mut())
    }
}

impl<'a, V> Iterator for ValuesMut<'a, V>
where
    V: 'a,
{
    type Item = &'a mut V;

    fn next(&mut self) -> Option<Self::Item> {
        self.0.next()
    }

    fn size_hint(&self) -> (usize, Option<usize>) {
        self.0.size_hint()
    }
}

impl<'a, V> DoubleEndedIterator for ValuesMut<'a, V>
where
    V: 'a,
{
    fn next_back(&mut self) -> Option<Self::Item> {
        self.0.next_back()
    }
}

impl<'a, V> ExactSizeIterator for ValuesMut<'a, V> {}
impl<'a, V> FusedIterator for ValuesMut<'a, V> {}