pub struct StatsResult {
pub root_type: String,
pub size_bytes: usize,
pub size_human: String,
pub depth: usize,
pub length: Option<usize>,
pub key_count: Option<usize>,
pub fields: Option<Vec<FieldAnalysis>>,
pub type_distribution: Option<HashMap<String, usize>>,
}Expand description
Statistics about JSON data structure.
Provides insights into JSON data including type, size, depth, and detailed field analysis for arrays of objects.
§Example
use jpx_engine::JpxEngine;
let engine = JpxEngine::new();
let stats = engine.stats(r#"{"users": [{"name": "alice"}, {"name": "bob"}]}"#).unwrap();
println!("Type: {}", stats.root_type); // "object"
println!("Size: {}", stats.size_human); // "52 bytes"
println!("Depth: {}", stats.depth); // 3Fields§
§root_type: StringJSON type of the root value (“object”, “array”, “string”, etc.)
size_bytes: usizeSize of the JSON string in bytes
size_human: StringHuman-readable size (e.g., “1.5 KB”, “2.3 MB”)
depth: usizeMaximum nesting depth (0 for primitives)
length: Option<usize>Number of items (arrays only)
key_count: Option<usize>Number of keys (objects only)
fields: Option<Vec<FieldAnalysis>>Field analysis (arrays of objects only)
type_distribution: Option<HashMap<String, usize>>Count of each JSON type in array (arrays only)
Trait Implementations§
Source§impl Clone for StatsResult
impl Clone for StatsResult
Source§fn clone(&self) -> StatsResult
fn clone(&self) -> StatsResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StatsResult
impl Debug for StatsResult
Source§impl<'de> Deserialize<'de> for StatsResult
impl<'de> Deserialize<'de> for StatsResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for StatsResult
impl RefUnwindSafe for StatsResult
impl Send for StatsResult
impl Sync for StatsResult
impl Unpin for StatsResult
impl UnwindSafe for StatsResult
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more