#[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>>,
pub schema_version: String,
}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/reference/policy.md in the repository for the full TOML schema reference.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
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>>§schema_version: StringDeclared policy schema version (e.g. "0.1.0").
Populated from policy.toml’s top-level schema_version field. Loader
requires the major.minor prefix to match
SUPPORTED_POLICY_SCHEMA_MAJOR_MINOR; documents that omit the field
soft-default to DEFAULT_POLICY_SCHEMA_VERSION for backward
compatibility with policies written before v0.7.2.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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