(s: &str, max_len: usize)
| 60 | } |
| 61 | |
| 62 | pub fn truncate_string(s: &str, max_len: usize) -> String { |
| 63 | if s.len() > max_len { |
| 64 | format!("{}...", &s.chars().take(max_len - 3).collect::<String>()) |
| 65 | } else { |
| 66 | s.to_string() |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | pub fn format_timestamp(ts: i64) -> String { |
| 71 | chrono::DateTime::from_timestamp_millis(ts) |