MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / docker_pull_progress_detail

Function docker_pull_progress_detail

crates/openshell-driver-docker/src/lib.rs:1666–1680  ·  view source on GitHub ↗
(info: &CreateImageInfo)

Source from the content-addressed store, hash-verified

1664}
1665
1666fn docker_pull_progress_detail(info: &CreateImageInfo) -> Option<String> {
1667 let status = info.status.as_deref().unwrap_or("Pulling");
1668 let layer_id = info.id.as_deref().filter(|id| !id.is_empty());
1669 let progress = info
1670 .progress_detail
1671 .as_ref()
1672 .and_then(format_progress_detail);
1673
1674 match (layer_id, progress) {
1675 (Some(layer_id), Some(progress)) => Some(format!("{status} {layer_id} ({progress})")),
1676 (Some(layer_id), None) => Some(format!("{status} {layer_id}")),
1677 (None, Some(progress)) => Some(format!("{status} ({progress})")),
1678 (None, None) => (!status.is_empty()).then(|| status.to_string()),
1679 }
1680}
1681
1682fn format_progress_detail(progress: &ProgressDetail) -> Option<String> {
1683 let current = progress.current.and_then(|value| u64::try_from(value).ok());

Callers 1

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected