Enum miri::borrow_tracker::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.
Grants shared mutable access.
Grants shared read-only access.
Disabled
Grants no access, but separates two groups of SharedReadWrite so they are not all considered mutually compatible.
Implementations§
source§impl Permission
impl Permission
source§impl 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.
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§
source§impl Clone for Permission
impl Clone for Permission
source§fn clone(&self) -> Permission
fn clone(&self) -> Permission
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Permission
impl Debug for Permission
source§impl Hash for Permission
impl Hash for Permission
source§impl PartialEq<Permission> for Permission
impl PartialEq<Permission> for Permission
source§fn eq(&self, other: &Permission) -> bool
fn eq(&self, other: &Permission) -> bool
self
and other
values to be equal, and is used
by ==
.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§
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
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