pub trait Handler: Send {
// Required method
fn as_any(&self) -> &dyn Any;
// Provided methods
fn start(
&mut self,
_path: &Path,
_matcher_idx: usize,
_token: Token,
) -> Result<Option<Vec<u8>>, Handler> { ... }
fn feed(
&mut self,
_data: &[u8],
_matcher_idx: usize,
) -> Result<Option<Vec<u8>>, Handler> { ... }
fn end(
&mut self,
_path: &Path,
_matcher_idx: usize,
_token: Token,
) -> Result<Option<Vec<u8>>, Handler> { ... }
fn is_converter(&self) -> bool { ... }
}
Expand description
Common handler trait
Required Methods§
Provided Methods§
Sourcefn 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>
Sourcefn 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
§Arguments
path
- path which was matchedmatcher_idx
- idx of matcher which was usedtoken
- further info about matched data
§Returns
Ok(None)
- All went well, no data conversion neededOk(Some(data))
- All went well, data convertedErr(_)
- Failed to execute handler
Sourcefn is_converter(&self) -> bool
fn is_converter(&self) -> bool
Should be handler used to convert data