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 for Permission
impl PartialEq for Permission
impl Copy for Permission
impl Eq for Permission
impl StructuralPartialEq for Permission
Auto Trait Implementations§
impl Freeze for Permission
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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