Function
truncate_text
(text: &str, max_chars: usize)
Source from the content-addressed store, hash-verified
| 609 | } |
| 610 | |
| 611 | fn truncate_text(text: &str, max_chars: usize) -> String { |
| 612 | if max_chars == 0 { |
| 613 | return String::new(); |
| 614 | } |
| 615 | if text.chars().count() <= max_chars { |
| 616 | return text.to_string(); |
| 617 | } |
| 618 | let mut out = String::with_capacity(max_chars + 1); |
| 619 | for ch in text.chars().take(max_chars.saturating_sub(1)) { |
| 620 | out.push(ch); |
| 621 | } |
| 622 | out.push('…'); |
| 623 | out |
| 624 | } |
| 625 | |
| 626 | fn split_path_segments(path: &str) -> (String, String) { |
| 627 | if path.is_empty() { |
Callers
nothing calls this directly
Tested by
no test coverage detected