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

Function format_hashes

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

Format a list of hashes for display.

(hashes: &[String])

Source from the content-addressed store, hash-verified

171
172/// Format a list of hashes for display.
173fn format_hashes(hashes: &[String]) -> String {
174 if hashes.is_empty() {
175 return String::from("(none)");
176 }
177 if hashes.len() <= 3 {
178 hashes.join(", ")
179 } else {
180 format!(
181 "{}, ... and {} more",
182 hashes[..3].join(", "),
183 hashes.len() - 3
184 )
185 }
186}
187
188impl RemoteError {
189 /// 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