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

Function source_hash

libatomic/examples/replication_acceptance/fixture.rs:33–39  ·  view source on GitHub ↗
(fm: &Map<String, Value>, body: &str)

Source from the content-addressed store, hash-verified

31 Ok(())
32}
33fn source_hash(fm: &Map<String, Value>, body: &str) -> String {
34 let mut h = blake3::Hasher::new();
35 h.update(serde_json::to_string(fm).unwrap().as_bytes());
36 h.update(b"\0");
37 h.update(body.as_bytes());
38 format!("blake3:{}", h.finalize().to_hex())
39}
40pub fn create(binary: &Path, root: &Path, config: &Path) -> Result<Fixture> {
41 let mut repo = Repository::init(root)?;
42 let working_copy = repo.require_working_copy_id()?;

Callers 1

createFunction · 0.70

Calls 3

updateMethod · 0.45
as_bytesMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected