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

Method new

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

Create a new dedup table with the change's own hash at index 0. The self hash is always the first entry in the table. All self-referencing positions in the change will use index 0. # Arguments `self_hash` - The Blake3 hash of the change being written. This is placed at index 0 ([`HASH_INDEX_SELF`]). # Examples ```rust use atomic_core::change::format_v3::HashDedupTable; let hash = blake3::has

(self_hash: [u8; 32])

Source from the content-addressed store, hash-verified

159 /// assert_eq!(table.resolve(0).unwrap(), &hash);
160 /// ```
161 pub fn new(self_hash: [u8; 32]) -> Self {
162 let mut index_map = HashMap::with_capacity(16);
163 index_map.insert(self_hash, HASH_INDEX_SELF);
164
165 Self {
166 hashes: vec![self_hash],
167 index_map,
168 }
169 }
170
171 /// Create an empty dedup table.
172 ///

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected