pub struct RegexInput<'h, S: Input + ?Sized> { /* private fields */ }Expand description
A search configuration for matching against a haystack.
This keeps the original haystack together with a starting search position and a range that constrains where the overall match may occur. Unlike slicing a haystack, anchors and lookaround can still inspect the full original input, and reported offsets remain absolute.
Implementations§
Source§impl<'h, S: Input + ?Sized> RegexInput<'h, S>
impl<'h, S: Input + ?Sized> RegexInput<'h, S>
Sourcepub fn from_pos(self, start: usize) -> Self
pub fn from_pos(self, start: usize) -> Self
Return a copy of this input with a different search start.
Sourcepub fn range(self, range: Range<usize>) -> Self
pub fn range(self, range: Range<usize>) -> Self
Return a copy of this input with a different search range.
§Panics
Panics if the range is not within the haystack bounds or if
range.start > range.end.
Sourcepub fn start_text(self, yes: bool) -> Self
pub fn start_text(self, yes: bool) -> Self
Return a copy of this input with an override for whether ^/\A
should match.
This override is suppression-only: false suppresses the assertion, while
true clears the override and preserves default behavior.
Sourcepub fn end_text(self, yes: bool) -> Self
pub fn end_text(self, yes: bool) -> Self
Return a copy of this input with an override for whether $/\z
should match.
This override is suppression-only: false suppresses the assertion, while
true clears the override and preserves default behavior.
Sourcepub fn continue_from_previous_match_end(self, yes: bool) -> Self
pub fn continue_from_previous_match_end(self, yes: bool) -> Self
Return a copy of this input with an override for whether \G should
match.
This override is suppression-only: false suppresses the assertion, while
true clears the override and preserves default behavior.
Sourcepub fn anchored(self, yes: bool) -> Self
pub fn anchored(self, yes: bool) -> Self
Return a copy of this input with an override for whether matching should be anchored at the start position.
When true, the regex will only match at the exact start position,
without scanning forward through the haystack. This is more efficient
when you already know where a potential match must occur.