[−][src]Trait streamson_lib::handler::Handler
Common handler trait
Required methods
fn handle(
&mut self,
path: &Path,
matcher_idx: usize,
data: Option<&[u8]>
) -> Result<Option<Vec<u8>>, Handler>
&mut self,
path: &Path,
matcher_idx: usize,
data: Option<&[u8]>
) -> Result<Option<Vec<u8>>, Handler>
Calls handler on matched data
Arguments
path
- path which was matchedmatcher_idx
- idx of matcher which was useddata
- matched data
Returns
Ok(None)
- All went well, no data conversion neededOk(Some(data))
- Alll went well, data convertedErr(_)
- Failed to execute handler
Errors
Handler failed (e.g. failed to write to output file).
Provided methods
fn handle_idx(
&mut self,
_path: &Path,
_matcher_idx: usize,
_idx: Output
) -> Result<(), Handler>
&mut self,
_path: &Path,
_matcher_idx: usize,
_idx: Output
) -> Result<(), Handler>
Calls when an index occured
Arguments
path
- path which was matchedidx
- input data index of next data after handlematcher_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 avoided
Implementors
impl Handler for Buffer
[src]
fn handle(
&mut self,
path: &Path,
_matcher_idx: usize,
data: Option<&[u8]>
) -> Result<Option<Vec<u8>>, Handler>
[src]
&mut self,
path: &Path,
_matcher_idx: usize,
data: Option<&[u8]>
) -> Result<Option<Vec<u8>>, Handler>
fn use_path(&self) -> bool
[src]
impl Handler for File
[src]
fn use_path(&self) -> bool
[src]
fn separator(&self) -> &str
[src]
fn handle(
&mut self,
path: &Path,
_matcher_idx: usize,
data: Option<&[u8]>
) -> Result<Option<Vec<u8>>, Handler>
[src]
&mut self,
path: &Path,
_matcher_idx: usize,
data: Option<&[u8]>
) -> Result<Option<Vec<u8>>, Handler>
impl Handler for Indexer
[src]
fn handle(
&mut self,
_path: &Path,
_matcher_idx: usize,
_data: Option<&[u8]>
) -> Result<Option<Vec<u8>>, Handler>
[src]
&mut self,
_path: &Path,
_matcher_idx: usize,
_data: Option<&[u8]>
) -> Result<Option<Vec<u8>>, Handler>
fn handle_idx(
&mut self,
path: &Path,
_matcher_idx: usize,
idx: Output
) -> Result<(), Handler>
[src]
&mut self,
path: &Path,
_matcher_idx: usize,
idx: Output
) -> Result<(), Handler>
fn use_path(&self) -> bool
[src]
fn buffering_required(&self) -> bool
[src]
impl Handler for PrintLn
[src]
fn use_path(&self) -> bool
[src]
fn separator(&self) -> &str
[src]
fn handle(
&mut self,
path: &Path,
_matcher_idx: usize,
data: Option<&[u8]>
) -> Result<Option<Vec<u8>>, Handler>
[src]
&mut self,
path: &Path,
_matcher_idx: usize,
data: Option<&[u8]>
) -> Result<Option<Vec<u8>>, Handler>