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

Method iter

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

Returns an iterator over all (index, hash) pairs in table order. The iterator yields entries in index order (0, 1, 2, ...). # Examples ```rust use atomic_core::change::format_v3::HashDedupTable; let h0 = [0u8; 32]; let h1 = [1u8; 32]; let mut table = HashDedupTable::new(h0); table.insert(h1).unwrap(); let entries: Vec<_> = table.iter().collect(); assert_eq!(entries.len(), 2); assert_eq!(entri

(&self)

Source from the content-addressed store, hash-verified

496 /// assert_eq!(entries[1], (1u16, &h1));
497 /// ```
498 pub fn iter(&self) -> impl Iterator<Item = (HashIndex, &[u8; 32])> {
499 self.hashes
500 .iter()
501 .enumerate()
502 .map(|(i, h)| (i as HashIndex, h))
503 }
504
505 /// Returns a slice of all hashes in table order.
506 ///

Callers 15

token_countMethod · 0.45
total_tokensMethod · 0.45
used_tokensMethod · 0.45
cache_tokensMethod · 0.45
get_creditMethod · 0.45
total_linesMethod · 0.45
has_ai_contentMethod · 0.45
ai_rangesMethod · 0.45
human_rangesMethod · 0.45
iter_linesMethod · 0.45
serializeMethod · 0.45
all_knownMethod · 0.45

Calls

no outgoing calls

Tested by 15

total_tokensMethod · 0.36
used_tokensMethod · 0.36
cache_tokensMethod · 0.36
test_chunk_deterministicFunction · 0.36
test_iter_orderFunction · 0.36
test_iter_emptyFunction · 0.36