GetMut

Trait GetMut 

Source
pub trait GetMut {
    type Error;
    type Input;
    type Output<'output>
       where Self: 'output;

    // Required method
    fn get_mut(
        &mut self,
        input: Self::Input,
    ) -> Result<Self::Output<'_>, Self::Error>;
}
Expand description

See GetMut::get_mut for more information.

Required Associated Types§

Source

type Error

Error

Source

type Input

Input

Source

type Output<'output> where Self: 'output

Output

Required Methods§

Source

fn get_mut( &mut self, input: Self::Input, ) -> Result<Self::Output<'_>, Self::Error>

Returns an mutable inner reference of a derived element.

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<T> GetMut for &mut [T]

let mut structure = cl_aux::doc_tests::slice_mut!();
assert_eq!(cl_aux::GetMut::get_mut(&mut structure, 0), Ok(&mut 1));
Source§

type Error = Error

Source§

type Input = usize

Source§

type Output<'output> = &'output mut T where Self: 'output

Source§

fn get_mut( &mut self, input: Self::Input, ) -> Result<Self::Output<'_>, Self::Error>

Source§

impl<T> GetMut for &mut T
where T: GetMut,

Source§

type Error = <T as GetMut>::Error

Source§

type Input = <T as GetMut>::Input

Source§

type Output<'output> = <T as GetMut>::Output<'output> where Self: 'output

Source§

fn get_mut( &mut self, input: Self::Input, ) -> Result<Self::Output<'_>, Self::Error>

Source§

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

let mut structure = cl_aux::doc_tests::array();
assert_eq!(cl_aux::GetMut::get_mut(&mut structure, 0), Ok(&mut 1));
Source§

type Error = Error

Source§

type Input = usize

Source§

type Output<'output> = &'output mut T where Self: 'output

Source§

fn get_mut( &mut self, input: Self::Input, ) -> Result<Self::Output<'_>, Self::Error>

Implementors§

Source§

impl<T> GetMut for SingleItemStorage<T>

let mut structure = cl_aux::doc_tests::single_item_storage();
assert_eq!(cl_aux::GetMut::get_mut(&mut structure, 0), Ok(&mut 1));
Source§

type Error = Error

Source§

type Input = usize

Source§

type Output<'output> = &'output mut T where Self: 'output