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

Method canonical_payload_bytes

atomic-repository/src/git_binding/codec.rs:291–298  ·  view source on GitHub ↗

Canonical V1 payload bytes: magic prefix + deterministic encoding.

(&self)

Source from the content-addressed store, hash-verified

289impl GitStateBindingPayload {
290 /// Canonical V1 payload bytes: magic prefix + deterministic encoding.
291 pub fn canonical_payload_bytes(&self) -> Result<Vec<u8>, BindingEncodeError> {
292 let encoded = postcard::to_allocvec(self)
293 .map_err(|error| BindingEncodeError::Encode(error.to_string()))?;
294 let mut bytes = Vec::with_capacity(BINDING_MAGIC.len() + encoded.len());
295 bytes.extend_from_slice(BINDING_MAGIC);
296 bytes.extend_from_slice(&encoded);
297 Ok(bytes)
298 }
299
300 /// Recompute `closure_root` over the ordered change hashes.
301 pub fn compute_closure_root(&self) -> Hash {

Calls 1

lenMethod · 0.45