Mutability

Trait Mutability 

Source
pub trait Mutability: MutabilityInner {
    type Ref<'a, T: 'a + ?Sized>: Deref<Target = T>;
    type Select<I, M>;

    // Required method
    fn select<I, M>(immut: I, mutable: M) -> Self::Select<I, M>;
}
Expand description

Marks whether a type is mutable or immutable.

Required Associated Types§

Source

type Ref<'a, T: 'a + ?Sized>: Deref<Target = T>

The reference type associated with this mutability.

Source

type Select<I, M>

Allows for choosing between one of two types based upon whether this is Const (in which case I is chosen) or Mut (in which case M is chosen).

Required Methods§

Source

fn select<I, M>(immut: I, mutable: M) -> Self::Select<I, M>

Allows for choosing between one of two values based upon whether this is Const (in which case immut is chosen) or Mut (in which case mut is chosen).

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.

Implementors§

Source§

impl Mutability for Const

Source§

type Ref<'a, T: 'a + ?Sized> = &'a T

Source§

type Select<I, M> = I

Source§

impl Mutability for Mut

Source§

type Ref<'a, T: 'a + ?Sized> = &'a mut T

Source§

type Select<I, M> = M