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

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

This defines for a given permission, whether it permits the given kind of access.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

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 bytes
  • SharedReadWrite: 0 bytes
  • SharedReadOnly: 0 bytes
  • Disabled: 0 bytes