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

Method fold

atomic-repository/src/manifest.rs:108–112  ·  view source on GitHub ↗

Fold a change sequence into its merkle state. This mirrors `put_change`: `state_n = state_{n-1}.next(hash_n)`, seeded at [`Merkle::ZERO`].

(changes: &[Hash])

Source from the content-addressed store, hash-verified

106 /// This mirrors `put_change`: `state_n = state_{n-1}.next(hash_n)`,
107 /// seeded at [`Merkle::ZERO`].
108 pub fn fold(changes: &[Hash]) -> Merkle {
109 changes
110 .iter()
111 .fold(Merkle::ZERO, |state, hash| state.next(hash))
112 }
113
114 /// Build a manifest from parts, computing the state from the log.
115 pub fn new(

Callers 1

sherpa_sessions_dirMethod · 0.80

Calls 2

iterMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected