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

Method expand_insertion

atomic-core/src/change/format_v3/compact/compactor.rs:186–207  ·  view source on GitHub ↗

Convert a [`CompactInsertion`] to an `Insertion >`.

(&self, v: &CompactInsertion)

Source from the content-addressed store, hash-verified

184
185 /// Convert a [`CompactInsertion`] to an `Insertion<Option<Hash>>`.
186 pub fn expand_insertion(&self, v: &CompactInsertion) -> FormatResult<Insertion<Option<Hash>>> {
187 let predecessors = v
188 .predecessors
189 .iter()
190 .map(|p| self.expand_position(p))
191 .collect::<FormatResult<Vec<_>>>()?;
192 let successors = v
193 .successors
194 .iter()
195 .map(|p| self.expand_position(p))
196 .collect::<FormatResult<Vec<_>>>()?;
197 let inode = self.expand_position(&v.inode)?;
198
199 Ok(Insertion {
200 predecessors,
201 successors,
202 flag: EdgeFlags::from_bits_truncate(v.flag),
203 start: ChangePosition::new(v.start as u64),
204 end: ChangePosition::new(v.end as u64),
205 inode,
206 })
207 }
208
209 /// Convert a [`CompactNewEdge`] to a `NewEdge<Option<Hash>>`.
210 pub fn expand_new_edge(&self, e: &CompactNewEdge) -> FormatResult<NewEdge<Option<Hash>>> {

Calls 2

expand_positionMethod · 0.80
iterMethod · 0.45