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

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

Common handler trait

Required methods

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

Calls handler on matched data

Arguments

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

Returns

  • Ok(None) - All went well, no data conversion needed
  • Ok(Some(data)) - Alll went well, data converted
  • Err(_) - Failed to execute handler

Errors

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

Loading content...

Provided methods

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

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

pub fn use_path(&self) -> bool[src]

Should path be used

pub fn separator(&self) -> &str[src]

A str which will be used to separate records

pub fn buffering_required(&self) -> bool[src]

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 avoided

Loading content...

Implementors

impl Handler for Analyser[src]

impl Handler for Buffer[src]

impl Handler for File[src]

impl Handler for Indexer[src]

impl Handler for PrintLn[src]

impl Handler for Replace[src]

impl Handler for Shorten[src]

impl Handler for Unstringify[src]

Loading content...