pub trait Input {
type Match<'t>
where Self: 't;
// Required methods
fn len(&self) -> usize;
fn as_bytes(&self) -> &[u8] ⓘ;
fn is_char_boundary(&self, ix: usize) -> bool;
fn is_ascii(&self) -> bool;
fn prev_codepoint_ix(&self, i: usize) -> usize;
fn make_match<'t>(&'t self, start: usize, end: usize) -> Self::Match<'t>;
fn advance_position(&self, i: usize) -> usize;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
A trait abstracting over haystack types for regex matching.
This trait is implemented for str, String, [u8], and [u8; N],
allowing regex methods to work with both UTF-8 text and raw byte slices.
When the regex is compiled with BytesMode::Ascii,
patterns like . will match any byte in [u8] input. Without bytes mode,
. only matches valid UTF-8 codepoints even in byte slices.
The associated type Match<'t> is the concrete match type
returned for a given input: Match<'t> for string inputs,
MatchBytes<'t> for byte slice inputs.
Required Associated Types§
Required Methods§
Sourcefn is_char_boundary(&self, ix: usize) -> bool
fn is_char_boundary(&self, ix: usize) -> bool
Returns true if ix is a valid position between UTF-8 codepoints.
Sourcefn prev_codepoint_ix(&self, i: usize) -> usize
fn prev_codepoint_ix(&self, i: usize) -> usize
Steps back one codepoint from position i, returning the start position.
Sourcefn make_match<'t>(&'t self, start: usize, end: usize) -> Self::Match<'t>
fn make_match<'t>(&'t self, start: usize, end: usize) -> Self::Match<'t>
Construct a match from byte offsets.
Sourcefn advance_position(&self, i: usize) -> usize
fn advance_position(&self, i: usize) -> usize
Advance past the codepoint at position i.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".