pub struct CachingStream<R>where
R: Read,{ /* private fields */ }Expand description
A wrapper around a Read that buffers and caches the data read in order to support searching with a regex.
Implementations§
Source§impl<R> CachingStream<R>where
R: Read,
impl<R> CachingStream<R>where
R: Read,
pub fn new(r: R) -> Self
Sourcepub fn clear_until(&self, offset: usize)
pub fn clear_until(&self, offset: usize)
Clear the inner gap buffer state up until the end of the line before the given offset, tracking the historic line and byte counts so we can correctly adjust future read offsets.
Data before offset will no longer be accessible.
Trait Implementations§
Source§impl<R> Debug for CachingStream<R>
impl<R> Debug for CachingStream<R>
Source§impl<R> Edit for CachingStream<R>where
R: Read,
impl<R> Edit for CachingStream<R>where
R: Read,
Source§fn begin_edit_transaction(&mut self)
fn begin_edit_transaction(&mut self)
Mark the start of an edit transaction
Source§fn end_edit_transaction(&mut self)
fn end_edit_transaction(&mut self)
Mark the end of an edit transaction
Source§impl<R> Haystack<Regex> for CachingStream<R>where
R: Read,
impl<R> Haystack<Regex> for CachingStream<R>where
R: Read,
Source§fn is_match_between(&self, re: &Regex, from: usize, to: usize) -> bool
fn is_match_between(&self, re: &Regex, from: usize, to: usize) -> bool
Returns true if there is a match for the regex between the given byte offsets in the haystack. Read more
Source§fn captures_between(
&self,
re: &Regex,
from: usize,
to: usize,
) -> Option<RawCaptures>
fn captures_between( &self, re: &Regex, from: usize, to: usize, ) -> Option<RawCaptures>
Searches for the first match of this regex between the given byte offsets in the given
haystack, returning the overall match along with the matches of each capture group in the
regex. If no match is found, then None is returned. Read more
Source§impl<R> Haystack for CachingStream<R>where
R: Read,
impl<R> Haystack for CachingStream<R>where
R: Read,
fn try_make_contiguous(&mut self)
fn is_contiguous(&self) -> bool
fn len(&self) -> usize
fn substr_from<'a>(&'a self, byte_offset: usize) -> Option<Cow<'a, str>>
fn substr<'a>(&'a self, byte_from: usize, byte_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)>
Source§impl<R> Sliceable for CachingStream<R>where
R: Read,
impl<R> Sliceable for CachingStream<R>where
R: Read,
Auto Trait Implementations§
impl<R> !Freeze for CachingStream<R>
impl<R> !RefUnwindSafe for CachingStream<R>
impl<R> Send for CachingStream<R>where
R: Send,
impl<R> !Sync for CachingStream<R>
impl<R> Unpin for CachingStream<R>where
R: Unpin,
impl<R> UnwindSafe for CachingStream<R>where
R: UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more