Format a hash for display with custom length. Like [`format_hash`], but allows specifying the truncation length. # Arguments `hash` - The hash to format `length` - Maximum characters to show (0 means no truncation) # Returns A formatted string representation of the hash.
(hash: &Hash, length: usize)
| 429 | /// |
| 430 | /// A formatted string representation of the hash. |
| 431 | pub fn format_hash_with_length(hash: &Hash, length: usize) -> String { |
| 432 | let base32 = hash.to_base32(); |
| 433 | if length == 0 || base32.len() <= length { |
| 434 | base32 |
| 435 | } else { |
| 436 | base32[..length].to_string() |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | /// Format a timestamp for display. |
| 441 | /// |