struct CompiledPat(Option<Regex>);Expand description
编译产物:把「坏正则降级为不匹配」的语义封装在一处。
调用方不再到处写 re_ref(re!(...))? 或手写 None 回退——直接调
CompiledPat::captures_head / CompiledPat::is_match,编译失败时返回
不匹配(None / false)。对应原始 Regex 方法的子集。
Tuple Fields§
§0: Option<Regex>Implementations§
Source§impl CompiledPat
impl CompiledPat
Sourcefn captures_head<'s>(&'s self, input: &'s str) -> Option<Captures<'s>>
fn captures_head<'s>(&'s self, input: &'s str) -> Option<Captures<'s>>
锚定头部匹配(坏正则 → None)。匹配失败/编译失败统一为不匹配。
fancy-regex 的 Captures 同时借用 regex 与 input,故签名把两者绑到同一
生命周期 's。调用处 self 来自 &*RE('static),所以实际约束是 input
须在 captures 使用期间存活——与原始 re.captures(input) 一致。
Auto Trait Implementations§
impl Freeze for CompiledPat
impl RefUnwindSafe for CompiledPat
impl Send for CompiledPat
impl Sync for CompiledPat
impl Unpin for CompiledPat
impl UnsafeUnpin for CompiledPat
impl UnwindSafe for CompiledPat
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
§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.