pub struct Policy { /* private fields */ }Implementations§
Source§impl Policy
impl Policy
pub fn new(rules_by_program: MultiMap<String, RuleRef>) -> Self
pub fn from_parts( rules_by_program: MultiMap<String, RuleRef>, network_rules: Vec<NetworkRule>, host_executables_by_name: HashMap<String, Arc<[AbsolutePathBuf]>>, ) -> Self
pub fn empty() -> Self
pub fn rules(&self) -> &MultiMap<String, RuleRef>
pub fn network_rules(&self) -> &[NetworkRule]
pub fn host_executables(&self) -> &HashMap<String, Arc<[AbsolutePathBuf]>>
pub fn get_allowed_prefixes(&self) -> Vec<Vec<String>>
pub fn add_prefix_rule( &mut self, prefix: &[String], decision: Decision, ) -> Result<()>
pub fn add_network_rule( &mut self, host: &str, protocol: NetworkRuleProtocol, decision: Decision, justification: Option<String>, ) -> Result<()>
pub fn set_host_executable_paths( &mut self, name: String, paths: Vec<AbsolutePathBuf>, )
pub fn merge_overlay(&self, overlay: &Policy) -> Policy
pub fn compiled_network_domains(&self) -> (Vec<String>, Vec<String>)
pub fn check<F>(&self, cmd: &[String], heuristics_fallback: &F) -> Evaluation
pub fn check_with_options<F>( &self, cmd: &[String], heuristics_fallback: &F, options: &MatchOptions, ) -> Evaluation
Sourcepub fn check_multiple<Commands, F>(
&self,
commands: Commands,
heuristics_fallback: &F,
) -> Evaluation
pub fn check_multiple<Commands, F>( &self, commands: Commands, heuristics_fallback: &F, ) -> Evaluation
Checks multiple commands and aggregates the results.
pub fn check_multiple_with_options<Commands, F>( &self, commands: Commands, heuristics_fallback: &F, options: &MatchOptions, ) -> Evaluation
Sourcepub fn matches_for_command(
&self,
cmd: &[String],
heuristics_fallback: Option<&'_ dyn Fn(&[String]) -> Decision>,
) -> Vec<RuleMatch>
pub fn matches_for_command( &self, cmd: &[String], heuristics_fallback: Option<&'_ dyn Fn(&[String]) -> Decision>, ) -> Vec<RuleMatch>
Returns matching rules for the given command. If no rules match and
heuristics_fallback is provided, returns a single
HeuristicsRuleMatch with the decision rendered by
heuristics_fallback.
If heuristics_fallback.is_some(), then the returned vector is
guaranteed to be non-empty.
pub fn matches_for_command_with_options( &self, cmd: &[String], heuristics_fallback: Option<&'_ dyn Fn(&[String]) -> Decision>, options: &MatchOptions, ) -> Vec<RuleMatch>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Policy
impl !UnwindSafe for Policy
impl Freeze for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnsafeUnpin for Policy
Blanket Implementations§
impl<T> AsTypeStaticRegistered for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> HasTyVTable for Twhere
T: ?Sized,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more