use super::{Equivalent, OrderSet};
use core::hash::{BuildHasher, Hash};
use indexmap::set::MutableValues as _;
pub trait MutableValues: private::Sealed {
type Value;
fn get_full_mut2<Q>(&mut self, value: &Q) -> Option<(usize, &mut Self::Value)>
where
Q: ?Sized + Hash + Equivalent<Self::Value>;
fn get_index_mut2(&mut self, index: usize) -> Option<&mut Self::Value>;
fn retain2<F>(&mut self, keep: F)
where
F: FnMut(&mut Self::Value) -> bool;
}
impl<T, S> MutableValues for OrderSet<T, S>
where
S: BuildHasher,
{
type Value = T;
fn get_full_mut2<Q>(&mut self, value: &Q) -> Option<(usize, &mut T)>
where
Q: ?Sized + Hash + Equivalent<T>,
{
self.inner.get_full_mut2(value)
}
fn get_index_mut2(&mut self, index: usize) -> Option<&mut T> {
self.inner.get_index_mut2(index)
}
fn retain2<F>(&mut self, keep: F)
where
F: FnMut(&mut T) -> bool,
{
self.inner.retain2(keep);
}
}
mod private {
pub trait Sealed {}
impl<T, S> Sealed for super::OrderSet<T, S> {}
}