pub struct Convert { /* private fields */ }
Expand description
Processes data from input and triggers handler
Implementations§
Source§impl Convert
impl Convert
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new Convert
It should replace a parts of the JSON using custom bytes data are read.
Sourcepub fn add_matcher(
&mut self,
matcher: Box<dyn Matcher>,
handler: Arc<Mutex<dyn Handler>>,
)
pub fn add_matcher( &mut self, matcher: Box<dyn Matcher>, handler: Arc<Mutex<dyn Handler>>, )
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'"']))),
);
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Convert
impl !RefUnwindSafe for Convert
impl Send for Convert
impl !Sync for Convert
impl Unpin for Convert
impl !UnwindSafe for Convert
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more