Generate a short preview for [`ToolTraceEntry`].
(s: &str)
| 1159 | |
| 1160 | /// Generate a short preview for [`ToolTraceEntry`]. |
| 1161 | fn preview(s: &str) -> String { |
| 1162 | if s.chars().count() <= MAX_PREVIEW_CHARS { |
| 1163 | s.to_string() |
| 1164 | } else { |
| 1165 | s.chars().take(MAX_PREVIEW_CHARS).collect::<String>() + "…" |
| 1166 | } |
| 1167 | } |
| 1168 | |
| 1169 | // ── Tests ─────────────────────────────────────────────────────── |
| 1170 |