Skip to main content

GetMut

Trait GetMut 

Source
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§

Source

fn get_mut(&mut self, index: Idx) -> Option<&mut Self::Output>

Returns a mutable reference to the value.

Provided Methods§

Source

fn get_mut_or_panic(&mut self, index: Idx) -> &mut Self::Output

Source

unsafe fn get_unchecked_mut(&mut self, index: Idx) -> &mut Self::Output

Returns a mutable reference to the value.

Source

fn replace(&mut self, index: Idx, value: Self::Output) -> Option<Self::Output>
where Self::Output: Sized,

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.

Source

fn replace_or_panic(&mut self, index: Idx, value: Self::Output) -> Self::Output
where Self::Output: Sized,

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.

Source

unsafe fn replace_unchecked( &mut self, index: Idx, value: Self::Output, ) -> Self::Output
where Self::Output: Sized,

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.

Source

fn set(&mut self, index: Idx, value: Self::Output) -> bool
where Self::Output: Sized,

Set the value and drop the previous one.

Source

fn set_or_panic(&mut self, index: Idx, value: Self::Output) -> &mut Self
where Self::Output: Sized,

Set the value and drop the previous one.

Source

unsafe fn set_unchecked(&mut self, index: Idx, value: Self::Output) -> &mut Self
where Self::Output: Sized,

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>
where G: IGrid<T, Idx, N>, Idx: Integer, P: Into<Vector<Idx, N>>,

Source§

fn get_mut( &mut self, index: P, ) -> Option<&mut <GridViewMut<'a, G, T, Idx, N> as Get<P>>::Output>

Source§

unsafe fn get_unchecked_mut( &mut self, index: P, ) -> &mut <GridViewMut<'a, G, T, Idx, N> as Get<P>>::Output

Source§

impl<'a, Q, K, V, Gen, S> GetMut<&'a Q> for GenMapOf<K, V, Gen, S>
where K: Clone + Borrow<Q>, Gen: IGeneration, S: Get<&'a Q, Output = GenIDOf<V, Gen>>, Q: ?Sized,

Source§

fn get_mut( &mut self, index: &'a Q, ) -> Option<&mut <GenMapOf<K, V, Gen, S> as Get<&'a Q>>::Output>

Source§

impl<Idx, T> GetMut<Idx> for &mut [T]
where Idx: SliceIndex<[T]>,

Source§

fn get_mut(&mut self, index: Idx) -> Option<&mut <&mut [T] as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked_mut( &mut self, index: Idx, ) -> &mut <&mut [T] as Get<Idx>>::Output

Source§

impl<Idx, T> GetMut<Idx> for [T]
where Idx: SliceIndex<[T]>,

Source§

fn get_mut(&mut self, index: Idx) -> Option<&mut <[T] as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked_mut( &mut self, index: Idx, ) -> &mut <[T] as Get<Idx>>::Output

Source§

impl<Idx, T> GetMut<Idx> for Vec<T>
where [T]: GetMut<Idx>,

Source§

fn get_mut(&mut self, index: Idx) -> Option<&mut <Vec<T> as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked_mut( &mut self, index: Idx, ) -> &mut <Vec<T> as Get<Idx>>::Output

Source§

impl<Idx, T, const CAP: usize> GetMut<Idx> for ArrayVec<T, CAP>
where [T]: GetMut<Idx>,

Source§

fn get_mut( &mut self, index: Idx, ) -> Option<&mut <ArrayVec<T, CAP> as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked_mut( &mut self, index: Idx, ) -> &mut <ArrayVec<T, CAP> as Get<Idx>>::Output

Source§

impl<Idx, T, const N: usize> GetMut<Idx> for [T; N]
where [T]: GetMut<Idx>,

Source§

fn get_mut(&mut self, index: Idx) -> Option<&mut <[T; N] as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked_mut( &mut self, index: Idx, ) -> &mut <[T; N] as Get<Idx>>::Output

Source§

impl<K, V, Gen, S> GetMut<GenIDOf<V, Gen>> for GenMapOf<K, V, Gen, S>
where K: Clone, Gen: IGeneration, S: Collection,

Source§

fn get_mut( &mut self, index: GenIDOf<V, Gen>, ) -> Option<&mut <GenMapOf<K, V, Gen, S> as Get<GenIDOf<V, Gen>>>::Output>

Source§

unsafe fn get_unchecked_mut( &mut self, index: GenIDOf<V, Gen>, ) -> &mut <GenMapOf<K, V, Gen, S> as Get<GenIDOf<V, Gen>>>::Output

Source§

impl<K, V, Gen, S> GetMut<UntypedGenIDOf<Gen>> for GenMapOf<K, V, Gen, S>
where K: Clone, Gen: IGeneration, S: Collection,

Source§

fn get_mut( &mut self, index: UntypedGenIDOf<Gen>, ) -> Option<&mut <GenMapOf<K, V, Gen, S> as Get<UntypedGenIDOf<Gen>>>::Output>

Source§

unsafe fn get_unchecked_mut( &mut self, index: UntypedGenIDOf<Gen>, ) -> &mut <GenMapOf<K, V, Gen, S> as Get<UntypedGenIDOf<Gen>>>::Output

Source§

impl<P, T, Idx, const N: usize> GetMut<P> for GridOf<T, Idx, N>
where Idx: Integer, P: Into<Vector<Idx, N>>,

Source§

fn get_mut( &mut self, pos: P, ) -> Option<&mut <GridOf<T, Idx, N> as Get<P>>::Output>

Source§

unsafe fn get_unchecked_mut( &mut self, pos: P, ) -> &mut <GridOf<T, Idx, N> as Get<P>>::Output

Source§

impl<T> GetMut<usize> for NonEmptyStack<T>

Source§

fn get_mut( &mut self, index: usize, ) -> Option<&mut <NonEmptyStack<T> as Get<usize>>::Output>

Source§

unsafe fn get_unchecked_mut( &mut self, index: usize, ) -> &mut <NonEmptyStack<T> as Get<usize>>::Output

Source§

impl<T, Gen, C> GetMut<usize> for GenSeq<T, Gen, C>
where C: AsRef<[Entry<T, Gen>]> + AsMut<[Entry<T, Gen>]>, Gen: IGeneration,

Source§

fn get_mut( &mut self, index: usize, ) -> Option<&mut <GenSeq<T, Gen, C> as Get<usize>>::Output>

Source§

impl<T, Gen, C> GetMut<GenIDOf<T, Gen>> for GenSeq<T, Gen, C>
where C: AsRef<[Entry<T, Gen>]> + AsMut<[Entry<T, Gen>]>, Gen: IGeneration,

Source§

fn get_mut( &mut self, index: GenIDOf<T, Gen>, ) -> Option<&mut <GenSeq<T, Gen, C> as Get<GenIDOf<T, Gen>>>::Output>

Source§

impl<T, Gen, C> GetMut<UntypedGenIDOf<Gen>> for GenSeq<T, Gen, C>
where C: AsRef<[Entry<T, Gen>]> + AsMut<[Entry<T, Gen>]>, Gen: IGeneration,

Source§

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>
where [T; 2]: GetMut<Idx>,

Source§

fn get_mut( &mut self, index: Idx, ) -> Option<&mut <RectangleOf<T> as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked_mut( &mut self, index: Idx, ) -> &mut <RectangleOf<T> as Get<Idx>>::Output

Source§

impl<T, const N: usize, Idx> GetMut<Idx> for Vector<T, N>
where [T; N]: GetMut<Idx>,

Source§

fn get_mut( &mut self, index: Idx, ) -> Option<&mut <Vector<T, N> as Get<Idx>>::Output>

Source§

unsafe fn get_unchecked_mut( &mut self, index: Idx, ) -> &mut <Vector<T, N> as Get<Idx>>::Output

Implementors§

Source§

impl<K, V, Q> GetMut<&Q> for BTreeMap<K, V>
where K: Borrow<Q> + Ord, Q: Ord + ?Sized,

Source§

impl<K, V, S, Q> GetMut<&Q> for HashMap<K, V, S>
where K: Borrow<Q> + Eq + Hash, Q: Hash + Eq + ?Sized, S: BuildHasher,

Available on crate feature std only.
Source§

impl<P, T, Idx> GetMut<P> for ImageBaseOf<T, Idx>
where Idx: Integer, P: Into<Vector<Idx, 2>>,

Source§

impl<T> GetMut<usize> for VecDeque<T>

Source§

impl<T, Idx> GetMut<Idx> for HslaOf<T>
where [T; 4]: GetMut<Idx>,

Source§

impl<T, Idx> GetMut<Idx> for RgbaOf<T>
where [T; 4]: GetMut<Idx>,