pub enum Mutability {
Mutable,
Immutable,
Any,
}
Expand description
Mutability of a pointer.
This is used to provide type safety for pointers.
A mutable pointer can be used to mutate the value it points to.
An immutable pointer can only be used to read the value it points to.
An Any
pointer can be used to read or write the value it points to; this is
used to override pointer access protections for compiler-builtins.
Variants§
Mutable
Mutable access to a value.
Immutable
Immutable access to a value. This is the default way to access a value.
Any
Unchecked access to a value. This is used to override access protections.
Implementations§
Source§impl Mutability
impl Mutability
Sourcepub fn can_decay_to(&self, other: &Self) -> bool
pub fn can_decay_to(&self, other: &Self) -> bool
Can a pointer of this mutability decay to a pointer of another mutability?
Mutable pointers can decay to immutable pointers, but immutable pointers
cannot decay to mutable pointers. Any
pointers are unchecked..
Sourcepub fn is_mutable(&self) -> bool
pub fn is_mutable(&self) -> bool
Can this data be accessed mutably?
Sourcepub fn is_constant(&self) -> bool
pub fn is_constant(&self) -> bool
Is this data protected against mutation?
Trait Implementations§
Source§impl Clone for Mutability
impl Clone for Mutability
Source§fn clone(&self) -> Mutability
fn clone(&self) -> Mutability
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Mutability
impl Debug for Mutability
Source§impl Default for Mutability
impl Default for Mutability
Source§fn default() -> Mutability
fn default() -> Mutability
Source§impl<'de> Deserialize<'de> for Mutability
impl<'de> Deserialize<'de> for Mutability
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for Mutability
impl Display for Mutability
Source§impl From<Mutability> for bool
impl From<Mutability> for bool
Convert a mutability into a boolean. It will return true if the data is mutable (or any), and false if it is immutable.
Source§fn from(m: Mutability) -> Self
fn from(m: Mutability) -> Self
Source§impl From<bool> for Mutability
impl From<bool> for Mutability
Convert a boolean into a mutability. True is mutable, false is immutable.
Source§impl Hash for Mutability
impl Hash for Mutability
Source§impl Ord for Mutability
impl Ord for Mutability
Source§fn cmp(&self, other: &Mutability) -> Ordering
fn cmp(&self, other: &Mutability) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for Mutability
impl PartialEq for Mutability
Check if two access types are equal.
Source§impl PartialOrd for Mutability
impl PartialOrd for Mutability
Source§impl Serialize for Mutability
impl Serialize for Mutability
impl Copy for Mutability
impl Eq for Mutability
Auto Trait Implementations§
impl Freeze for Mutability
impl RefUnwindSafe for Mutability
impl Send for Mutability
impl Sync for Mutability
impl Unpin for Mutability
impl UnwindSafe for Mutability
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more