pub struct Search { /* private fields */ }
Expand description
A compiled searcher for multiple patterns against a stream of text
Implementations§
source§impl Search
impl Search
sourcepub fn compile(patterns: &[impl AsRef<str>]) -> Result<Self, Error>
pub fn compile(patterns: &[impl AsRef<str>]) -> Result<Self, Error>
Try to compile multiple patterns, raising any parse error encountered
sourcepub fn next(&mut self, haystack: impl AsRef<str>) -> Vec<Match>
pub fn next(&mut self, haystack: impl AsRef<str>) -> Vec<Match>
Step through a chunk of text, yielding any matches that are definitely-complete This function panics if called while the stream is partially-through a utf-8 char (after a call to next_bytes)
sourcepub fn next_bytes(
&mut self,
haystack: &[u8],
) -> Result<Vec<Match>, SearchStreamError>
pub fn next_bytes( &mut self, haystack: &[u8], ) -> Result<Vec<Match>, SearchStreamError>
Step through a chunk of bytes, yielding any matches that are definitely-complete This function panics if given definitely-invalid utf8 An incomplete character may fill the last 1-3 bytes In which case, the character fragment will be completed on the next call to next_bytes
sourcepub fn iter<R: BufRead>(&mut self, reader: R) -> StreamSearch<'_, R> ⓘ
pub fn iter<R: BufRead>(&mut self, reader: R) -> StreamSearch<'_, R> ⓘ
Iterate over a buffered reader
sourcepub fn peek_finish(&self) -> Vec<Match>
pub fn peek_finish(&self) -> Vec<Match>
Yield any pending, not-definitely-complete matches
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Search
impl RefUnwindSafe for Search
impl Send for Search
impl Sync for Search
impl Unpin for Search
impl UnwindSafe for Search
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)