pub enum CompiledPattern {
Text(String),
Regex(Regex),
}Expand description
Compiled, hot-path-ready pattern. Caches the compiled regex::Regex
(跟 TS RegExp 对象内部 compile-once cache 同精神 — TS RegExp lazily
compiles on first .test() and re-uses the compiled DFA; we eager-
compile via Pattern::compile and store the result for the same
effect on Rust side).
Not serde-serializable (regex::Regex 不 derive Serialize/Deserialize).
Wire form is Pattern; resolver/SDK convert with .compile() once.
Variants§
Text(String)
Plain literal string (case-insensitive ASCII equality).
Regex(Regex)
Compiled regex (case-insensitive via auto-injected (?i) prefix).
Trait Implementations§
Source§impl Clone for CompiledPattern
impl Clone for CompiledPattern
Source§fn clone(&self) -> CompiledPattern
fn clone(&self) -> CompiledPattern
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CompiledPattern
impl RefUnwindSafe for CompiledPattern
impl Send for CompiledPattern
impl Sync for CompiledPattern
impl Unpin for CompiledPattern
impl UnsafeUnpin for CompiledPattern
impl UnwindSafe for CompiledPattern
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