(text: &str, max_len: usize)
| 1370 | } |
| 1371 | |
| 1372 | fn limit_text_len(text: &str, max_len: usize) -> String { |
| 1373 | if text.chars().count() <= max_len { |
| 1374 | return text.to_string(); |
| 1375 | } |
| 1376 | |
| 1377 | let mut truncated: String = text.chars().take(max_len).collect(); |
| 1378 | truncated.push_str("..."); |
| 1379 | truncated |
| 1380 | } |
no test coverage detected