pub struct EngineBuilder { /* private fields */ }Expand description
Builds an Engine. Start with Engine::builder.
use veil_engine::{Engine, RulesFile, ScopeId};
let engine = Engine::builder().rules(RulesFile::default()).build()?;
let r = engine.redact_text(&ScopeId::new("chat-42"), "Email ana@example.com")?;
assert_eq!(r.text, "Email [EMAIL_1]");Implementations§
Source§impl EngineBuilder
impl EngineBuilder
Sourcepub fn rules(self, rules: RulesFile) -> Self
pub fn rules(self, rules: RulesFile) -> Self
What to detect. Default: RulesFile::default.
Sourcepub fn options(self, options: Options) -> Self
pub fn options(self, options: Options) -> Self
The placeholder format and restoration options. Default: Options::default.
Sourcepub fn recognizer(self, recognizer: Arc<dyn EntityRecognizer>) -> Self
pub fn recognizer(self, recognizer: Arc<dyn EntityRecognizer>) -> Self
The name-detection model, used when the rules turn name detection on. Without one, such rules make every redaction fail rather than send names.
Sourcepub fn compiled_rules(self, rules: CompiledRules) -> Self
pub fn compiled_rules(self, rules: CompiledRules) -> Self
Rules compiled in advance with CompiledRules::compile, used as they
are. Replaces anything given to rules,
options and recognizer.
Sourcepub fn vault(self, vault: Arc<dyn Vault>) -> Self
pub fn vault(self, vault: Arc<dyn Vault>) -> Self
Where placeholder mappings are kept. Default: a new MemoryVault.
Sourcepub fn recorder(self, recorder: Arc<dyn Recorder>) -> Self
pub fn recorder(self, recorder: Arc<dyn Recorder>) -> Self
Told about every value that live traffic matched. Default: none.
Sourcepub fn scan_cache_bytes(self, bytes: usize) -> Self
pub fn scan_cache_bytes(self, bytes: usize) -> Self
Memory for remembering scans between calls, in bytes; 0 scans every
call in full. Default: DEFAULT_SCAN_CACHE_BUDGET.
Sourcepub fn build(self) -> Result<Engine, RulesError>
pub fn build(self) -> Result<Engine, RulesError>
Compiles the rules, unless they were given compiled, and builds the engine.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for EngineBuilder
impl !UnwindSafe for EngineBuilder
impl Freeze for EngineBuilder
impl Send for EngineBuilder
impl Sync for EngineBuilder
impl Unpin for EngineBuilder
impl UnsafeUnpin for EngineBuilder
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> 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