Skip to main content

ValidationCache

Struct ValidationCache 

Source
pub struct ValidationCache { /* private fields */ }
Expand description

The disk-backed pattern-validation cache.

Implementations§

Source§

impl ValidationCache

Source

pub fn load(path: &Path) -> Self

Load (or start) the cache at path: a missing file starts empty (LoadOutcome::Absent), a corrupt or unreadable file starts empty (LoadOutcome::Corrupt), and entries stamped with another engine version drop on load.

Source

pub fn outcome(&self) -> &LoadOutcome

The load outcome (the caller logs it).

Source

pub fn key(pattern: &str, ignore_case: bool) -> String

The reference _key: sha256 over the pattern, a 0x00 separator, and the flags char (i when case-insensitive).

Source

pub fn get(&self, pattern: &str, ignore_case: bool) -> Option<(bool, String)>

The cached verdict, None when the pattern was never certified.

Source

pub fn put(&self, pattern: &str, ignore_case: bool, safe: bool, reason: &str)

Record one verdict and persist atomically (tmp file plus rename; a failed write leaves the in-memory entry and drops the persistence, the reference’s logged-but-survivable outcome).

Source

pub fn validate_compat(&self, pattern: &str) -> (bool, String)

The cached validation entry point (the validate_pattern_safety compat shape): the cheap deterministic layers always re-run, the empirical cost-verdict layer answers from the cache on a hit and persists on a miss.

Source

pub fn validate_with_flags( &self, pattern: &str, ignore_case: bool, ) -> (bool, String)

ValidationCache::validate_compat with the flags char explicit (a pattern validated under different flags caches separately).

Trait Implementations§

Source§

impl Debug for ValidationCache

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.