pub enum Shared {}
Expand description
Represents the mutability of a shared reference, &T
.
Along with Mutable
, this is one of the two types that can be used as a generic mutability parameter.
It is an empty type because it is always used as a generic parameter and never as a value.
Just as with &T
, interior mutability types may change while behind a reference of Shared
mutability.
Implementations§
Sourcepub fn mutability() -> IsShared<Shared>
pub fn mutability() -> IsShared<Shared>
This method returns a proof for the shared-ness of Shared
.
Note: this method shadows <Shared as Mutability>::mutability()
, which returns the same proof wrapped in MutabilityEnum::Shared
.
If you have access to this method (i.e. in non-generic contexts), you should not need <Shared as Mutability>::mutability()
.
Trait Implementations§
Source§fn mutability() -> MutabilityEnum<Self>
fn mutability() -> MutabilityEnum<Self>
The result of this method lets you match over the mutability values to obtain a proof, which can be used to access features that are only available for one mutability. Read more
Auto Trait Implementations§
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
Mutably borrows from an owned value. Read more