Generate a short preview for [`ToolTraceEntry`].
(s: &str)
| 1201 | |
| 1202 | /// Generate a short preview for [`ToolTraceEntry`]. |
| 1203 | fn preview(s: &str) -> String { |
| 1204 | if s.chars().count() <= MAX_PREVIEW_CHARS { |
| 1205 | s.to_string() |
| 1206 | } else { |
| 1207 | s.chars().take(MAX_PREVIEW_CHARS).collect::<String>() + "…" |
| 1208 | } |
| 1209 | } |
| 1210 | |
| 1211 | // ── Tests ─────────────────────────────────────────────────────── |
| 1212 |