[][src]Trait streamson_lib::handler::Handler

pub trait Handler: Send {
    fn handle(
        &mut self,
        path: &Path,
        matcher_idx: usize,
        data: Option<&[u8]>
    ) -> Result<(), Handler>; fn handle_idx(
        &mut self,
        _path: &Path,
        _matcher_idx: usize,
        _idx: Output
    ) -> Result<(), Handler> { ... }
fn use_path(&self) -> bool { ... }
fn separator(&self) -> &str { ... }
fn buffering_required(&self) -> bool { ... } }

Common handler trait

Required methods

fn handle(
    &mut self,
    path: &Path,
    matcher_idx: usize,
    data: Option<&[u8]>
) -> Result<(), Handler>

Calls handler on matched data

Arguments

  • path - path which was matched
  • matcher_idx- idx of matcher which was used
  • data - matched data

Returns

  • Ok(()) - Handler was successfully executed
  • Err(_) - Failed to execute handler

Errors

Handler failed (e.g. failed to write to output file).

Loading content...

Provided methods

fn handle_idx(
    &mut self,
    _path: &Path,
    _matcher_idx: usize,
    _idx: Output
) -> Result<(), Handler>

Calls when an index occured

Arguments

  • path - path which was matched
  • idx - input data index of next data after handle
  • matcher_idx- idx of matcher which was used

fn use_path(&self) -> bool

Should path be used

fn separator(&self) -> &str

A str which will be used to separate records

fn buffering_required(&self) -> bool

If true is returned a buffer will be used to store input data when matcher matches

Required for most of the handlers, but there can be situations where, it can be avioded

Loading content...

Implementors

impl Handler for Buffer[src]

impl Handler for File[src]

impl Handler for Indexer[src]

impl Handler for PrintLn[src]

Loading content...