#[non_exhaustive]pub struct Policy {
pub session: SessionPolicy,
pub detectors: Vec<DetectorSpec>,
pub dictionaries: Vec<RulepackDict>,
pub rules: Vec<RuleSpec>,
pub ner: Option<NerPolicy>,
pub rulepacks: RulepackPolicy,
pub locale: Option<Vec<LocaleTag>>,
}Expand description
Loaded redaction policy from a TOML configuration file.
Defines which rulepacks activate, which recognizers are enabled, and the locale chain.
Load with Policy::load for library use or Policy::load_for_cli for CLI hosts.
Both signatures take &std::path::Path.
Production deployments must use a policy – the no-policy builder path is for development smoke-testing only and has an unauditable detection posture.
See docs/policy.md in the repository for the full TOML schema reference.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.session: SessionPolicy§detectors: Vec<DetectorSpec>§dictionaries: Vec<RulepackDict>§rules: Vec<RuleSpec>§ner: Option<NerPolicy>§rulepacks: RulepackPolicy§locale: Option<Vec<LocaleTag>>Implementations§
Source§impl Policy
impl Policy
pub fn load(path: &Path) -> Result<Policy, PolicyError>
pub fn load_for_cli(path: &Path) -> Result<Policy, PolicyError>
Trait Implementations§
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