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

Function format_hashes

atomic-remote/src/error.rs:144–157  ·  view source on GitHub ↗

Format a list of hashes for display.

(hashes: &[String])

Source from the content-addressed store, hash-verified

142
143/// Format a list of hashes for display.
144fn format_hashes(hashes: &[String]) -> String {
145 if hashes.is_empty() {
146 return String::from("(none)");
147 }
148 if hashes.len() <= 3 {
149 hashes.join(", ")
150 } else {
151 format!(
152 "{}, ... and {} more",
153 hashes[..3].join(", "),
154 hashes.len() - 3
155 )
156 }
157}
158
159impl RemoteError {
160 /// Create a connection failed error.

Callers

nothing calls this directly

Calls 2

is_emptyMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected