pub struct JsonProfiler { /* private fields */ }Expand description
Profiles JSON records path by path in bounded memory. See the module docs.
use rich_data::profile::{JsonProfiler, ProfileOptions};
use serde_json::json;
let options = ProfileOptions { depth: 1, ..Default::default() };
let mut profiler = JsonProfiler::new(options);
profiler.push(&json!({"a": {"b": 1}}));
profiler.push(&json!({"a": "x"}));
let profile = profiler.finish().unwrap();
let a = profile.column("a").unwrap();
// One step deep: the object is a value of `a`, as its JSON text.
assert_eq!(a.types.unwrap().mix(), "str 50% · obj 50%");
assert_eq!(a.distinct, 2);Implementations§
Source§impl JsonProfiler
impl JsonProfiler
Sourcepub fn new(options: ProfileOptions) -> Self
pub fn new(options: ProfileOptions) -> Self
A profiler with options (depth, max_paths, sample, top,
bins, buckets and columns, which names paths).
Sourcepub fn skip_malformed(&mut self, line: usize, message: impl Into<String>)
pub fn skip_malformed(&mut self, line: usize, message: impl Into<String>)
Count a line that could not be read as JSON (it is not a record): its 1-based number and why.
Trait Implementations§
Source§impl Clone for JsonProfiler
impl Clone for JsonProfiler
Auto Trait Implementations§
impl Freeze for JsonProfiler
impl RefUnwindSafe for JsonProfiler
impl Send for JsonProfiler
impl Sync for JsonProfiler
impl Unpin for JsonProfiler
impl UnsafeUnpin for JsonProfiler
impl UnwindSafe for JsonProfiler
Blanket Implementations§
impl<T> Allocation for T
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