pub struct Vault { /* private fields */ }Expand description
The mapping vault that maintains entity<->token consistency.
Implementations§
Source§impl Vault
impl Vault
Sourcepub fn open(path: &str, key: Vec<u8>) -> Result<Self>
pub fn open(path: &str, key: Vec<u8>) -> Result<Self>
Create or load a vault from the given path.
Sourcepub fn set_resolver(&mut self, resolver: EntityResolver)
pub fn set_resolver(&mut self, resolver: EntityResolver)
Configure the fuzzy entity resolver on this vault.
Sourcepub fn get_or_create(
&mut self,
original: &str,
category: &EntityCategory,
) -> PseudoToken
pub fn get_or_create( &mut self, original: &str, category: &EntityCategory, ) -> PseudoToken
Get or create a pseudo-token for the given original value.
If a fuzzy entity resolver is configured, checks for similar existing entries before creating a new token. This merges variant spellings (e.g., “Rishi” and “Rishikesh”) to the same token.
Sourcepub fn lookup(&self, token: &str) -> Option<&str>
pub fn lookup(&self, token: &str) -> Option<&str>
Look up the original value for a pseudo-token (for rehydration).
Sourcepub fn reverse_mappings(&self) -> HashMap<String, String>
pub fn reverse_mappings(&self) -> HashMap<String, String>
Get all reverse mappings (for rehydration).
Sourcepub fn stats(&self) -> VaultStats
pub fn stats(&self) -> VaultStats
Get vault statistics (safe to expose — no sensitive data).
Auto Trait Implementations§
impl Freeze for Vault
impl RefUnwindSafe for Vault
impl Send for Vault
impl Sync for Vault
impl Unpin for Vault
impl UnsafeUnpin for Vault
impl UnwindSafe for Vault
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