Truncate message for display
(s: &str, max_len: usize)
| 367 | |
| 368 | /// Truncate message for display |
| 369 | pub fn truncate_message(s: &str, max_len: usize) -> String { |
| 370 | if s.len() <= max_len { |
| 371 | return s.to_string(); |
| 372 | } |
| 373 | |
| 374 | let truncated = truncate_safe(s, max_len); |
| 375 | if let Some(pos) = truncated.rfind(' ') { |
| 376 | format!("{}...", &truncated[..pos]) |
| 377 | } else { |
| 378 | format!("{}...", truncated) |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | pub const CHECKPOINT_MESSAGE_MAX_LENGTH: usize = 60; |
| 383 |
no test coverage detected