pub trait GetMut<Idx>: Get<Idx> {
// Required method
fn get_mut(&mut self, index: Idx) -> Option<&mut Self::Output>;
// Provided methods
fn get_mut_or_panic(&mut self, index: Idx) -> &mut Self::Output { ... }
unsafe fn get_unchecked_mut(&mut self, index: Idx) -> &mut Self::Output { ... }
fn replace(
&mut self,
index: Idx,
value: Self::Output,
) -> Option<Self::Output>
where Self::Output: Sized { ... }
fn replace_or_panic(
&mut self,
index: Idx,
value: Self::Output,
) -> Self::Output
where Self::Output: Sized { ... }
unsafe fn replace_unchecked(
&mut self,
index: Idx,
value: Self::Output,
) -> Self::Output
where Self::Output: Sized { ... }
fn set(&mut self, index: Idx, value: Self::Output) -> bool
where Self::Output: Sized { ... }
fn set_or_panic(&mut self, index: Idx, value: Self::Output) -> &mut Self
where Self::Output: Sized { ... }
unsafe fn set_unchecked(
&mut self,
index: Idx,
value: Self::Output,
) -> &mut Self
where Self::Output: Sized { ... }
}Required Methods§
Provided Methods§
fn get_mut_or_panic(&mut self, index: Idx) -> &mut Self::Output
Sourceunsafe fn get_unchecked_mut(&mut self, index: Idx) -> &mut Self::Output
unsafe fn get_unchecked_mut(&mut self, index: Idx) -> &mut Self::Output
Returns a mutable reference to the value.
Sourcefn replace(&mut self, index: Idx, value: Self::Output) -> Option<Self::Output>
fn replace(&mut self, index: Idx, value: Self::Output) -> Option<Self::Output>
Replace the value and return the old one.
This operation is an involution:
Replacing a value twice (first with a new value, then with the previously returned value) leaves the collection unchanged.
Sourcefn replace_or_panic(&mut self, index: Idx, value: Self::Output) -> Self::Output
fn replace_or_panic(&mut self, index: Idx, value: Self::Output) -> Self::Output
Replace the value and return the old one.
This operation is an involution:
Replacing a value twice (first with a new value, then with the previously returned value) leaves the collection unchanged.
Sourceunsafe fn replace_unchecked(
&mut self,
index: Idx,
value: Self::Output,
) -> Self::Output
unsafe fn replace_unchecked( &mut self, index: Idx, value: Self::Output, ) -> Self::Output
Replace the value and return the old one.
This operation is an involution:
Replacing a value twice (first with a new value, then with the previously returned value) leaves the collection unchanged.
Sourcefn set(&mut self, index: Idx, value: Self::Output) -> bool
fn set(&mut self, index: Idx, value: Self::Output) -> bool
Set the value and drop the previous one.
Sourcefn set_or_panic(&mut self, index: Idx, value: Self::Output) -> &mut Self
fn set_or_panic(&mut self, index: Idx, value: Self::Output) -> &mut Self
Set the value and drop the previous one.
unsafe fn set_unchecked(&mut self, index: Idx, value: Self::Output) -> &mut Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<'a, P, G, T, Idx, const N: usize> GetMut<P> for GridViewMut<'a, G, T, Idx, N>
impl<'a, P, G, T, Idx, const N: usize> GetMut<P> for GridViewMut<'a, G, T, Idx, N>
fn get_mut( &mut self, index: P, ) -> Option<&mut <GridViewMut<'a, G, T, Idx, N> as Get<P>>::Output>
unsafe fn get_unchecked_mut( &mut self, index: P, ) -> &mut <GridViewMut<'a, G, T, Idx, N> as Get<P>>::Output
Source§impl<K, V, Gen, S> GetMut<UntypedGenIDOf<Gen>> for GenMapOf<K, V, Gen, S>
impl<K, V, Gen, S> GetMut<UntypedGenIDOf<Gen>> for GenMapOf<K, V, Gen, S>
fn get_mut( &mut self, index: UntypedGenIDOf<Gen>, ) -> Option<&mut <GenMapOf<K, V, Gen, S> as Get<UntypedGenIDOf<Gen>>>::Output>
unsafe fn get_unchecked_mut( &mut self, index: UntypedGenIDOf<Gen>, ) -> &mut <GenMapOf<K, V, Gen, S> as Get<UntypedGenIDOf<Gen>>>::Output
Source§impl<T> GetMut<usize> for NonEmptyStack<T>
impl<T> GetMut<usize> for NonEmptyStack<T>
Source§impl<T, Gen, C> GetMut<UntypedGenIDOf<Gen>> for GenSeq<T, Gen, C>
impl<T, Gen, C> GetMut<UntypedGenIDOf<Gen>> for GenSeq<T, Gen, C>
fn get_mut( &mut self, index: UntypedGenIDOf<Gen>, ) -> Option<&mut <GenSeq<T, Gen, C> as Get<UntypedGenIDOf<Gen>>>::Output>
Source§impl<T, Idx> GetMut<Idx> for RectangleOf<T>
impl<T, Idx> GetMut<Idx> for RectangleOf<T>
fn get_mut( &mut self, index: Idx, ) -> Option<&mut <RectangleOf<T> as Get<Idx>>::Output>
unsafe fn get_unchecked_mut( &mut self, index: Idx, ) -> &mut <RectangleOf<T> as Get<Idx>>::Output
Implementors§
impl<K, V, Q> GetMut<&Q> for BTreeMap<K, V>
impl<K, V, S, Q> GetMut<&Q> for HashMap<K, V, S>
std only.