[−][src]Struct streamson_lib::strategy::extract::Extract
Implementations
impl Extract
[src]
pub fn new() -> Self
[src]
Creates a new Extract
It exracts matched data parts (not nested)
pub fn set_export_path(self, export: bool) -> Self
[src]
Sets whether path should be exported with data
if path is not exported extraction can be a bit faster
pub fn add_matcher(&mut self, matcher: Box<dyn MatchMaker>)
[src]
Adds new matcher for data extraction
Arguments
matcher
- matcher which matches the path
Example
use streamson_lib::{strategy, matcher}; use std::sync::{Arc, Mutex}; let mut extract = strategy::Extract::new(); let matcher = matcher::Simple::new(r#"{"list"}[]"#).unwrap(); let mut extract = strategy::Extract::new(); extract.add_matcher( Box::new(matcher), );
pub fn process(
&mut self,
input: &[u8]
) -> Result<Vec<(Option<String>, Vec<u8>)>, General>
[src]
&mut self,
input: &[u8]
) -> Result<Vec<(Option<String>, Vec<u8>)>, General>
Processes input data
Returns
Ok(Vec<(Some(r#"{"users"}[0]"#), Vec<u8>)>)
vector containing path and dataOk(Vec<(None, Vec<u8>)>)
vector data onlyErr(_)
when input is not correct json
Example
use streamson_lib::strategy; let mut extract = strategy::Extract::new(); extract.process(br#"{}"#);
Errors
- Error is triggered when incorrect json is detected Note that not all json errors are detected
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Extract
impl Send for Extract
impl !Sync for Extract
impl Unpin for Extract
impl !UnwindSafe for Extract
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,