Format a list of hashes for display.
(hashes: &[String])
| 171 | |
| 172 | /// Format a list of hashes for display. |
| 173 | fn 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 | |
| 188 | impl RemoteError { |
| 189 | /// Create a connection failed error. |