pub struct Indexer { /* private fields */ }
Expand description
Indexer handler responsible for storing index of the matches
Implementations§
Source§impl Indexer
impl Indexer
Sourcepub fn set_use_path(self, use_path: bool) -> Self
pub fn set_use_path(self, use_path: bool) -> Self
Sourcepub fn pop(&mut self) -> Option<(Option<String>, Token)>
pub fn pop(&mut self) -> Option<(Option<String>, Token)>
Pops the oldest value in the buffer
§Returns
None
- queue is emptySome((path, output))
- stored data remove from the queue and returned
§Example
use streamson_lib::handler;
let mut indexer = handler::Indexer::new().set_use_path(true);
while let Some((path, output)) = indexer.pop() {
// Do something with the data
println!("{} ({:?})", path.unwrap(), output);
}
Trait Implementations§
Source§impl Handler for Indexer
impl Handler for Indexer
Source§fn start(
&mut self,
path: &Path,
_matcher_idx: usize,
token: Token,
) -> Result<Option<Vec<u8>>, Handler>
fn start( &mut self, path: &Path, _matcher_idx: usize, token: Token, ) -> Result<Option<Vec<u8>>, Handler>
Is called when a path is matched Read more
Source§fn end(
&mut self,
path: &Path,
matcher_idx: usize,
token: Token,
) -> Result<Option<Vec<u8>>, Handler>
fn end( &mut self, path: &Path, matcher_idx: usize, token: Token, ) -> Result<Option<Vec<u8>>, Handler>
Is called when the path is no longer matched Read more
Source§fn feed(
&mut self,
_data: &[u8],
_matcher_idx: usize,
) -> Result<Option<Vec<u8>>, Handler>
fn feed( &mut self, _data: &[u8], _matcher_idx: usize, ) -> Result<Option<Vec<u8>>, Handler>
Is called when handler receives some data Read more
Source§fn is_converter(&self) -> bool
fn is_converter(&self) -> bool
Should be handler used to convert data
Auto Trait Implementations§
impl Freeze for Indexer
impl RefUnwindSafe for Indexer
impl Send for Indexer
impl Sync for Indexer
impl Unpin for Indexer
impl UnwindSafe for Indexer
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