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

Method compact_position

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

Convert a `Position >` to a [`CompactPosition`]. # Errors Returns [`FormatError::HashNotFound`](super::super::error::FormatError::HashNotFound) if the hash isn't in the dedup table.

(&self, pos: &Position<Option<Hash>>)

Source from the content-addressed store, hash-verified

69 /// Returns [`FormatError::HashNotFound`](super::super::error::FormatError::HashNotFound)
70 /// if the hash isn't in the dedup table.
71 pub fn compact_position(&self, pos: &Position<Option<Hash>>) -> FormatResult<CompactPosition> {
72 let change = self.hash_to_index(&pos.change)?;
73 Ok(CompactPosition::new(change, pos.pos.get() as u32))
74 }
75
76 /// Convert a `GraphNode<Option<Hash>>` to a [`CompactGraphNode`].
77 ///

Calls 2

hash_to_indexMethod · 0.80
getMethod · 0.65