Trait bitvec::ptr::Mutability[][src]

pub trait Mutability: 'static + Copy + Sealed {
    pub const CONTAINS_MUTABILITY: bool;
    pub const PEANO_NUMBER: usize;
    pub const SELF: Self;
    pub const RENDER: &'static str;
    pub fn freeze(self) -> Frozen<Self> { ... }
pub fn thaw(Frozen<Self>) -> Self { ... } }

Generalized mutability permissions.

This trait enables referent structures to be generic over the write permissions of their referent data. As an example, the standard library defines *const T and *mut T as two duplicate type families, that cannot share any logic at all.

An equivalent library implementation might be Ptr<T, M: Mutability>, where shared logic can be placed in an impl<T, M> Ptr<T, M> block, but unique logic (such as freezing a Mut pointer, or unfreezing a Frozen<Mut>) can be placed in specialized impl<T> Ptr<T, Mut> blocks.

Associated Constants

pub const CONTAINS_MUTABILITY: bool[src]

Marks whether this type contains mutability permissions within it.

This is false for Const and true for Mut. Frozen wrappers atop either of these types inherit their interior marker.

pub const PEANO_NUMBER: usize[src]

Counts the layers of Frozen<> wrapping around a base Const or Mut.

pub const SELF: Self[src]

Allow instances to be constructed generically.

pub const RENDER: &'static str[src]

One of *const or *mut.

Loading content...

Provided methods

pub fn freeze(self) -> Frozen<Self>[src]

Freeze this type, wrapping it in a const marker that may later be removed to thaw it.

pub fn thaw(Frozen<Self>) -> Self[src]

Thaw a previously-frozen type, removing its Frozen marker and restoring it to Self.

Loading content...

Implementations on Foreign Types

impl<Inner> Mutability for Frozen<Inner> where
    Inner: Mutability
[src]

Loading content...

Implementors

impl Mutability for Const[src]

impl Mutability for Mut[src]

Loading content...