Format a list of hashes for display.
(hashes: &[String])
| 142 | |
| 143 | /// Format a list of hashes for display. |
| 144 | fn 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 | |
| 159 | impl RemoteError { |
| 160 | /// Create a connection failed error. |