pub trait Haystack {
// Required methods
fn try_make_contiguous(&mut self);
fn is_contiguous(&self) -> bool;
fn len(&self) -> usize;
fn substr_from<'a>(&'a self, offset: usize) -> Option<Cow<'a, str>>;
fn substr<'a>(&'a self, from: usize, to: usize) -> Cow<'a, str>;
fn byte_to_char(&self, byte_idx: usize) -> Option<usize>;
fn char_to_byte(&self, char_idx: usize) -> Option<usize>;
fn iter_from(
&self,
from: usize,
) -> Option<impl Iterator<Item = (usize, char)>>;
fn iter_between(
&self,
from: usize,
to: usize,
) -> impl Iterator<Item = (usize, char)>;
fn rev_iter_between(
&self,
from: usize,
to: usize,
) -> impl Iterator<Item = (usize, char)>;
}Expand description
Something that can be searched over by a Regex.
The interface exposed by this trait supports searching over streaming data if needed but at the cost of reduced performance.
Required Methods§
fn try_make_contiguous(&mut self)
fn is_contiguous(&self) -> bool
fn len(&self) -> usize
fn substr_from<'a>(&'a self, offset: usize) -> Option<Cow<'a, str>>
fn substr<'a>(&'a self, from: usize, to: usize) -> Cow<'a, str>
fn byte_to_char(&self, byte_idx: usize) -> Option<usize>
fn char_to_byte(&self, char_idx: usize) -> Option<usize>
fn iter_from(&self, from: usize) -> Option<impl Iterator<Item = (usize, char)>>
fn iter_between( &self, from: usize, to: usize, ) -> impl Iterator<Item = (usize, char)>
fn rev_iter_between( &self, from: usize, to: usize, ) -> impl Iterator<Item = (usize, char)>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.