pub struct Level {
pub name: String,
pub allow: Vec<Clause>,
pub deny: Vec<Clause>,
}Expand description
A safety level: a name, its allow clauses (disjunction), and its deny clauses (allow-only subtractive corners, §4.1).
Fields§
§name: String§allow: Vec<Clause>§deny: Vec<Clause>Implementations§
Source§impl Level
impl Level
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
An empty level (admits only the empty profile). Build it up with
Level::allowing / Level::denying.
Sourcepub fn allowing(self, clause: Clause) -> Self
pub fn allowing(self, clause: Clause) -> Self
Add an allow clause (widens the admissible region).
Sourcepub fn denying(self, clause: Clause) -> Self
pub fn denying(self, clause: Clause) -> Self
Add a deny clause (subtracts a corner; never grants).
Sourcepub fn admits_capability(&self, cap: &Capability) -> bool
pub fn admits_capability(&self, cap: &Capability) -> bool
Whether a single capability is admissible: some allow clause admits it and no deny clause matches it.
Sourcepub fn admits(&self, profile: &Profile) -> bool
pub fn admits(&self, profile: &Profile) -> bool
Whether a whole profile passes: every capability is admissible. The empty profile passes vacuously.
Sourcepub fn extend(
base: &Level,
name: impl Into<String>,
extra_allow: Vec<Clause>,
) -> Level
pub fn extend( base: &Level, name: impl Into<String>, extra_allow: Vec<Clause>, ) -> Level
Author a level by extending base (R27: extends only loosens). The result
inherits base’s allow and deny clauses unchanged and adds only allow
clauses — it cannot drop an allow or add a deny, so extends ⇒ superset holds
by construction. yolo’s subtractive deny is authored directly, never via
extend.
Trait Implementations§
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,
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.