Struct Indexer

Source
pub struct Indexer { /* private fields */ }
Expand description

Indexer handler responsible for storing index of the matches

Implementations§

Source§

impl Indexer

Source

pub fn new() -> Self

Creates a new handler which stores indexes within itself

Source

pub fn set_use_path(self, use_path: bool) -> Self

Set whether to show path

§Arguments
  • use_path - should path be store with data
§Example
use streamson_lib::handler;
let file = handler::Indexer::new().set_use_path(true);
Source

pub fn pop(&mut self) -> Option<(Option<String>, Token)>

Pops the oldest value in the buffer

§Returns
  • None - queue is empty
  • Some((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 Debug for Indexer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Indexer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl FromStr for Indexer

Source§

type Err = Handler

The associated error which can be returned from parsing.
Source§

fn from_str(input: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Handler for Indexer

Source§

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>

Is called when the path is no longer matched Read more
Source§

fn as_any(&self) -> &dyn Any

Function to allow downcasting
Source§

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

Should be handler used to convert data

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.