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

Function finalize_hunks

atomic-core/src/record/workflow/assembly/helpers.rs:170–183  ·  view source on GitHub ↗

Finalize hunks by converting them to the serializable format. This validates that all hunks are properly formed and ready for serialization. # Arguments `hunks` - The hunks to finalize `options` - Assembly options for validation # Returns The validated hunks, or an error if validation fails.

(
    hunks: Vec<GraphOp<Option<Hash>>>,
    options: &AssemblyOptions,
)

Source from the content-addressed store, hash-verified

168///
169/// The validated hunks, or an error if validation fails.
170pub fn finalize_hunks(
171 hunks: Vec<GraphOp<Option<Hash>>>,
172 options: &AssemblyOptions,
173) -> AssemblyResult<Vec<GraphOp<Option<Hash>>>> {
174 // Check graph_op count limit
175 if hunks.len() > options.get_max_hunks() {
176 return Err(AssemblyError::TooManyHunks {
177 actual: hunks.len(),
178 limit: options.get_max_hunks(),
179 });
180 }
181
182 Ok(hunks)
183}

Callers 2

Calls 2

get_max_hunksMethod · 0.80
lenMethod · 0.45

Tested by 2