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

Function classify_inventory

atomic-cli/src/commands/clone/helpers.rs:481–495  ·  view source on GitHub ↗

Classify an `?views` inventory for `--all-views`. `applied` is the set of view names the primary manifest chain already reconstructed (always non-empty by the time additional views are considered).

(inventory: &[String], applied: &HashSet<String>)

Source from the content-addressed store, hash-verified

479/// reconstructed (always non-empty by the time additional views are
480/// considered).
481pub fn classify_inventory(inventory: &[String], applied: &HashSet<String>) -> InventoryOutcome {
482 if inventory.is_empty() {
483 return InventoryOutcome::Unsupported;
484 }
485 let others: Vec<String> = inventory
486 .iter()
487 .filter(|name| !applied.contains(*name))
488 .cloned()
489 .collect();
490 if others.is_empty() {
491 InventoryOutcome::NothingNew
492 } else {
493 InventoryOutcome::Views(others)
494 }
495}
496
497// Error Conversion
498

Callers 1

Calls 3

is_emptyMethod · 0.45
iterMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected