pub enum Level {
None,
ReadOnly,
Sandboxed,
Loopback,
ReadWrite,
Allowlist,
Full,
}Expand description
Trust level along a single dimension. Levels are totally ordered
from None (no authority) upward; the numeric discriminant is the
order, so <=/max/min on the rank give the lattice operations.
The levels are shared across dimensions (a deliberately small vocabulary) but not every level is meaningful on every dimension — the canonical readings are:
| rank | Filesystem | Network | Exec |
|---|---|---|---|
| 0 | none | none | none |
| 1 | read-only | loopback | sandboxed |
| 2 | read-write | allowlist | (= full) |
| 3 | full | full | full |
Sandboxed aliases rank 1 for exec; Allowlist aliases rank 2 for
network. They are distinct enum variants for legibility but compare
purely by Level::rank.
Variants§
None
rank 0 — the effect is physically absent from the box.
ReadOnly
rank 1 — read-only / loopback-only / sandboxed-exec.
Sandboxed
rank 1 — exec spelled for legibility (same rank as ReadOnly).
Loopback
rank 1 — network loopback only.
ReadWrite
rank 2 — read-write filesystem.
Allowlist
rank 2 — network restricted to an allowlist.
Full
rank 3 — unrestricted authority on the dimension.
Implementations§
Source§impl Level
impl Level
Sourcepub fn rank(self) -> u8
pub fn rank(self) -> u8
The position of this level in the total order. Lattice operations are defined on the rank.
Sourcepub fn leq(self, other: Level) -> bool
pub fn leq(self, other: Level) -> bool
self ≤ other in the trust order (self grants no more than
other). This is the per-dimension subtyping relation.
Sourcepub fn join(self, other: Level) -> Level
pub fn join(self, other: Level) -> Level
Least upper bound (join): the tighter of two levels that still covers both. Returns the higher-ranked level.
Sourcepub fn meet(self, other: Level) -> Level
pub fn meet(self, other: Level) -> Level
Greatest lower bound (meet): the most authority both allow. Returns the lower-ranked level.
pub fn as_str(self) -> &'static str
Trait Implementations§
impl Copy for Level
Source§impl<'de> Deserialize<'de> for Level
impl<'de> Deserialize<'de> for Level
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Level
impl StructuralPartialEq for Level
Auto Trait Implementations§
impl Freeze for Level
impl RefUnwindSafe for Level
impl Send for Level
impl Sync for Level
impl Unpin for Level
impl UnsafeUnpin for Level
impl UnwindSafe for Level
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.