pub struct PolicySet {
pub rules: Vec<PolicyRule>,
pub version: u64,
}Fields§
§rules: Vec<PolicyRule>§version: u64Implementations§
Source§impl PolicySet
impl PolicySet
pub fn add_rule(&mut self, rule: PolicyRule)
pub fn remove_rule(&mut self, index: usize) -> Option<PolicyRule>
pub fn set_rules(&mut self, rules: Vec<PolicyRule>)
pub fn max_risk(&self, default: RiskLevel) -> RiskLevel
pub fn denied(&self, caps: &[Capability]) -> Option<Capability>
pub fn allows(&self, caps: &[Capability]) -> bool
pub fn deny_cvss_threshold(&self) -> Option<f64>
pub fn has_cvss_rules(&self) -> bool
Sourcepub fn load_yaml(path: impl AsRef<Path>) -> Result<Self, String>
pub fn load_yaml(path: impl AsRef<Path>) -> Result<Self, String>
Load policy rules from a YAML file on disk.
Sourcepub fn load_yaml_str(s: &str) -> Result<Self, String>
pub fn load_yaml_str(s: &str) -> Result<Self, String>
Parse policy rules from a YAML string.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PolicySet
impl<'de> Deserialize<'de> for PolicySet
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
Auto Trait Implementations§
impl Freeze for PolicySet
impl RefUnwindSafe for PolicySet
impl Send for PolicySet
impl Sync for PolicySet
impl Unpin for PolicySet
impl UnsafeUnpin for PolicySet
impl UnwindSafe for PolicySet
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