MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / stats

Method stats

atomic-core/src/change/format_v3/hash_table.rs:689–696  ·  view source on GitHub ↗

Return statistics about the table for debugging and logging. # Examples ```rust use atomic_core::change::format_v3::HashDedupTable; let mut table = HashDedupTable::new([0u8; 32]); table.insert([1u8; 32]).unwrap(); table.insert([2u8; 32]).unwrap(); let stats = table.stats(); assert_eq!(stats.entry_count, 3); assert_eq!(stats.dependency_count, 2); assert_eq!(stats.serialized_bytes, 96); ```

(&self)

Source from the content-addressed store, hash-verified

687 /// assert_eq!(stats.serialized_bytes, 96);
688 /// ```
689 pub fn stats(&self) -> HashDedupTableStats {
690 let entry_count = self.hashes.len();
691 HashDedupTableStats {
692 entry_count,
693 dependency_count: entry_count.saturating_sub(1),
694 serialized_bytes: entry_count * HASH_SIZE,
695 }
696 }
697}
698
699impl fmt::Debug for HashDedupTable {

Callers 4

test_stats_emptyFunction · 0.45
test_stats_with_entriesFunction · 0.45
test_stats_displayFunction · 0.45

Calls 1

lenMethod · 0.45

Tested by 4

test_stats_emptyFunction · 0.36
test_stats_with_entriesFunction · 0.36
test_stats_displayFunction · 0.36