#![no_std]
use core::ops::*;
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Const;
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Mut;
pub trait Mutability: private::MutabilityInner {
type Ref<'a, T: 'a + ?Sized>: Deref<Target = T>;
type Select<I, M>;
fn select<I, M>(immut: I, mutable: M) -> Self::Select<I, M>;
}
impl Mutability for Const {
type Ref<'a, T: 'a + ?Sized> = &'a T;
type Select<I, M> = I;
fn select<I, M>(immut: I, _: M) -> Self::Select<I, M> {
immut
}
}
impl Mutability for Mut {
type Ref<'a, T: 'a + ?Sized> = &'a mut T;
type Select<I, M> = M;
fn select<I, M>(_: I, mutable: M) -> Self::Select<I, M> {
mutable
}
}
mod private {
use super::*;
pub trait MutabilityInner: 'static + Copy + Clone + Send + Sync + core::fmt::Debug + Default + PartialEq + Eq + PartialOrd + Ord + core::hash::Hash {}
impl MutabilityInner for Const {}
impl MutabilityInner for Mut {}
}