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

Function classify_inventory

atomic-cli/src/commands/clone/helpers.rs:500–514  ·  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

498/// reconstructed (always non-empty by the time additional views are
499/// considered).
500pub fn classify_inventory(inventory: &[String], applied: &HashSet<String>) -> InventoryOutcome {
501 if inventory.is_empty() {
502 return InventoryOutcome::Unsupported;
503 }
504 let others: Vec<String> = inventory
505 .iter()
506 .filter(|name| !applied.contains(*name))
507 .cloned()
508 .collect();
509 if others.is_empty() {
510 InventoryOutcome::NothingNew
511 } else {
512 InventoryOutcome::Views(others)
513 }
514}
515
516// Error Conversion
517

Callers 1

Calls 4

is_emptyMethod · 0.45
collectMethod · 0.45
iterMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected