Struct streamson_lib::strategy::convert::Convert [−][src]
pub struct Convert { /* fields omitted */ }
Processes data from input and triggers handler
Implementations
impl Convert
[src]
impl Convert
[src]pub fn new() -> Self
[src]
pub fn new() -> Self
[src]Creates a new Convert
It should replace a parts of the JSON using custom bytes data are read.
pub fn add_matcher(
&mut self,
matcher: Box<dyn Matcher>,
handler: Arc<Mutex<dyn Handler>>
)
[src]
pub fn add_matcher(
&mut self,
matcher: Box<dyn Matcher>,
handler: Arc<Mutex<dyn Handler>>
)
[src]Adds a mathcher and a handler to Convert
Arguments
matcher
- matcher which matches the pathhandlers
- funtions which should be run to convert the data
Example
use streamson_lib::{strategy, matcher, handler, path::Path}; use std::sync::{Arc, Mutex}; let mut convert = strategy::Convert::new(); let matcher = matcher::Simple::new(r#"{"list"}[]"#).unwrap(); convert.add_matcher( Box::new(matcher), Arc::new(Mutex::new(handler::Replace::new(vec![b'"', b'*', b'*', b'*', b'"']))), );