streamson-extra-matchers 4.1.0

Extra matchers for streamson library
Documentation

docs.rs

Streamson extra matcher

A library which contains extra matchers for streamson-lib. Note that this library may contain additional dependencies.

Matchers

Regex

Matches path based on regex.

Example

use streamson_lib::{handler, Collector};
use streamson_extra_matchers::Regex;

use std::{str::FromStr, sync::{Arc, Mutex}};

let handler = Arc::new(Mutex::new(handler::PrintLn::new()));
let matcher = Regex::from_str(r#"\{"[Uu]ser"\}\[\]"#).unwrap();

let mut collector = Collector::new();

collector.add_matcher(
    Box::new(matcher),
    &[handler],
);

for input in vec![
    br#"{"Users": [1,2]"#.to_vec(),
    br#", "users": [3, 4]}"#.to_vec(),
] {
    collector.process(&input).unwrap();
}