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

Function short_hash

atomic-cli/src/commands/rpc.rs:189–199  ·  view source on GitHub ↗
(hash: &Option<pb::Hash>)

Source from the content-addressed store, hash-verified

187}
188
189fn short_hash(hash: &Option<pb::Hash>) -> String {
190 hash.as_ref()
191 .and_then(|h| {
192 h.value
193 .clone()
194 .try_into()
195 .ok()
196 .map(|bytes: [u8; 32]| Merkle(bytes).to_base32()[..12].to_string())
197 })
198 .unwrap_or_else(|| "-".to_string())
199}
200
201fn full_hash(hash: &Option<pb::Hash>) -> String {
202 hash.as_ref()

Callers 3

insert_previewFunction · 0.70
pushFunction · 0.70
pullFunction · 0.70

Calls 5

MerkleClass · 0.85
as_refMethod · 0.80
okMethod · 0.45
cloneMethod · 0.45
to_base32Method · 0.45

Tested by

no test coverage detected