pub struct DocumentStats {Show 14 fields
pub total_nodes: usize,
pub max_depth: usize,
pub string_count: usize,
pub number_count: usize,
pub boolean_count: usize,
pub array_count: usize,
pub mapping_count: usize,
pub set_count: usize,
pub anchor_count: usize,
pub alias_count: usize,
pub tagged_count: usize,
pub total_string_bytes: usize,
pub largest_array: usize,
pub largest_mapping: usize,
}Expand description
Document statistics for performance analysis Statistics about a YAML document structure
Fields§
§total_nodes: usizeTotal number of nodes in the document
max_depth: usizeMaximum nesting depth
string_count: usizeNumber of string nodes
number_count: usizeNumber of numeric nodes
boolean_count: usizeNumber of boolean nodes
array_count: usizeNumber of array/sequence nodes
mapping_count: usizeNumber of mapping nodes
set_count: usizeNumber of set nodes
anchor_count: usizeNumber of anchor nodes
alias_count: usizeNumber of alias nodes
tagged_count: usizeNumber of tagged nodes
total_string_bytes: usizeTotal string length (bytes)
largest_array: usizeLargest array size
largest_mapping: usizeLargest mapping size
Implementations§
Source§impl DocumentStats
impl DocumentStats
Sourcepub fn from_node(node: &Node) -> Self
pub fn from_node(node: &Node) -> Self
Gather statistics from a Node tree
§Example
let doc = Node::Array(vec![
Node::from(1),
Node::from("text"),
Node::Array(vec![Node::from(2)])
]);
let stats = DocumentStats::from_node(&doc);
assert_eq!(stats.total_nodes, 5);
assert_eq!(stats.max_depth, 2);
assert_eq!(stats.array_count, 2);Sourcepub fn estimated_memory_bytes(&self) -> usize
pub fn estimated_memory_bytes(&self) -> usize
Calculate estimated memory usage in bytes
Trait Implementations§
Source§impl Clone for DocumentStats
impl Clone for DocumentStats
Source§fn clone(&self) -> DocumentStats
fn clone(&self) -> DocumentStats
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 DocumentStats
impl Debug for DocumentStats
Source§impl Default for DocumentStats
impl Default for DocumentStats
Source§fn default() -> DocumentStats
fn default() -> DocumentStats
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DocumentStats
impl RefUnwindSafe for DocumentStats
impl Send for DocumentStats
impl Sync for DocumentStats
impl Unpin for DocumentStats
impl UnsafeUnpin for DocumentStats
impl UnwindSafe for DocumentStats
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