Enum miri::stacked_borrows::item::Permission
source · [−]pub enum Permission {
Unique,
SharedReadWrite,
SharedReadOnly,
Disabled,
}
Expand description
Indicates which permission is granted (by this item to some pointers)
Variants
Unique
Grants unique mutable access.
SharedReadWrite
Grants shared mutable access.
SharedReadOnly
Grants shared read-only access.
Disabled
Grants no access, but separates two groups of SharedReadWrite so they are not all considered mutually compatible.
Implementations
sourceimpl Permission
impl Permission
sourceimpl Permission
impl Permission
We need to make at least the following things true:
U1: After creating a Uniq
, it is at the top.
U2: If the top is Uniq
, accesses must be through that Uniq
or remove it it.
U3: If an access happens with a Uniq
, it requires the Uniq
to be in the stack.
F1: After creating a &
, the parts outside UnsafeCell
have our SharedReadOnly
on top.
F2: If a write access happens, it pops the SharedReadOnly
. This has three pieces:
F2a: If a write happens granted by an item below our SharedReadOnly
, the SharedReadOnly
gets popped.
F2b: No SharedReadWrite
or Unique
will ever be added on top of our SharedReadOnly
.
F3: If an access happens with an &
outside UnsafeCell
,
it requires the SharedReadOnly
to still be in the stack.
Core relation on Permission
to define which accesses are allowed
sourcefn grants(self, access: AccessKind) -> bool
fn grants(self, access: AccessKind) -> bool
This defines for a given permission, whether it permits the given kind of access.
Trait Implementations
sourceimpl Clone for Permission
impl Clone for Permission
sourcefn clone(&self) -> Permission
fn clone(&self) -> Permission
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for Permission
impl Debug for Permission
sourceimpl Hash for Permission
impl Hash for Permission
sourceimpl PartialEq<Permission> for Permission
impl PartialEq<Permission> for Permission
sourcefn eq(&self, other: &Permission) -> bool
fn eq(&self, other: &Permission) -> bool
impl Copy for Permission
impl Eq for Permission
impl StructuralEq for Permission
impl StructuralPartialEq for Permission
Auto Trait Implementations
impl RefUnwindSafe for Permission
impl Send for Permission
impl Sync for Permission
impl Unpin for Permission
impl UnwindSafe for Permission
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 1 byte
Size for each variant:
Unique
: 0 bytesSharedReadWrite
: 0 bytesSharedReadOnly
: 0 bytesDisabled
: 0 bytes