pub struct Policy {
pub mode: Option<Mode>,
pub threshold: Option<u8>,
pub rules: Rules,
}Expand description
A parsed policy document.
Fields§
§mode: Option<Mode>Optional operating mode for this scope.
threshold: Option<u8>Risk threshold (0..=100) for the graduated unattended band: an ambiguous command scored at/above this is denied+queued, below it is allowed.
rules: RulesAllow/deny rule lists.
Implementations§
Source§impl Policy
impl Policy
Sourcepub fn merge(global: Policy, repo: Policy) -> Policy
pub fn merge(global: Policy, repo: Policy) -> Policy
Merge repo over global: repo mode wins; rule lists are concatenated
(global first, then repo).
Sourcepub fn risk_threshold(&self) -> u8
pub fn risk_threshold(&self) -> u8
The effective risk threshold for the ambiguous band.
Sourcepub fn action_for(&self, command: &str) -> PolicyAction
pub fn action_for(&self, command: &str) -> PolicyAction
Decide what this policy says about a command. Deny wins over allow.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Policy
impl<'de> Deserialize<'de> for Policy
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Policy
impl StructuralPartialEq for Policy
Auto Trait Implementations§
impl Freeze for Policy
impl RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnsafeUnpin for Policy
impl UnwindSafe for Policy
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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
Compare self to
key and return true if they are equal.