Trait MutableValues
trait MutableValues: private::Sealed
Opt-in mutable access to IndexSet values.
These methods expose &mut T, mutable references to the value as it is stored
in the set.
You are allowed to modify the values in the set if the modification
does not change the value’s hash and equality.
If values are modified erroneously, you can no longer look them up.
This is sound (memory safe) but a logical error hazard (just like
implementing PartialEq, Eq, or Hash incorrectly would be).
use this trait to enable its methods for IndexSet.
This trait is sealed and cannot be implemented for types outside this crate.
Associated Types
type Value
Required Methods
fn get_full_mut2<Q>(self: &mut Self, value: &Q) -> Option<(usize, &mut <Self as >::Value)> where Q: ?Sized + Hash + Equivalent<<Self as >::Value>Return item index and mutable reference to the value
Computes in O(1) time (average).
fn get_index_mut2(self: &mut Self, index: usize) -> Option<&mut <Self as >::Value>Return mutable reference to the value at an index.
Valid indices are
0 <= index < self.len().Computes in O(1) time.
fn retain2<F>(self: &mut Self, keep: F) where F: FnMut(&mut <Self as >::Value) -> boolScan through each value in the set and keep those where the closure
keepreturnstrue.The values are visited in order, and remaining values keep their order.
Computes in O(n) time (average).
Implementors
impl<T, S> MutableValues for IndexSet<T, S>