Truncate a string for inclusion in error messages.
(s: &str, max_len: usize)
| 349 | |
| 350 | /// Truncate a string for inclusion in error messages. |
| 351 | pub(crate) fn truncate_for_error(s: &str, max_len: usize) -> String { |
| 352 | if s.len() <= max_len { |
| 353 | s.to_string() |
| 354 | } else { |
| 355 | format!("{}...", &s[..max_len]) |
| 356 | } |
| 357 | } |
| 358 | |
| 359 | /// Generate reasoning from a condensed transcript using the default generator. |
| 360 | /// |