pub struct ValuePatterns {
pub patterns: Vec<CompiledValuePattern>,
pub fallback_kind: FieldKind,
}Expand description
Ordered list of value-sampling patterns loaded from heuristics_values.toml.
Fields§
§patterns: Vec<CompiledValuePattern>§fallback_kind: FieldKindImplementations§
Source§impl ValuePatterns
impl ValuePatterns
Sourcepub fn from_toml_str(s: &str) -> Result<Self, ZerError>
pub fn from_toml_str(s: &str) -> Result<Self, ZerError>
Parse from a TOML string. Returns Err if any regex is invalid.
Sourcepub fn load_default() -> Self
pub fn load_default() -> Self
Load the default patterns.
Checks ZER_VALUE_PATTERNS env var first; if set and loadable, uses
that file. Otherwise falls back to the embedded heuristics_values.toml.
Sourcepub fn infer_kind(&self, samples: &[&str]) -> FieldKind
pub fn infer_kind(&self, samples: &[&str]) -> FieldKind
Infer a FieldKind from a slice of sampled text values.
Evaluates patterns in order; returns the first match. Falls back to
fallback_kind (typically FreeText) when nothing matches.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ValuePatterns
impl RefUnwindSafe for ValuePatterns
impl Send for ValuePatterns
impl Sync for ValuePatterns
impl Unpin for ValuePatterns
impl UnsafeUnpin for ValuePatterns
impl UnwindSafe for ValuePatterns
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