Format the header for display. Returns a multi-line string suitable for showing to users.
(&self)
| 282 | /// |
| 283 | /// Returns a multi-line string suitable for showing to users. |
| 284 | pub fn format_display(&self) -> String { |
| 285 | let mut result = String::new(); |
| 286 | |
| 287 | // Authors |
| 288 | for author in &self.authors { |
| 289 | result.push_str(&format!("Author: {}\n", author)); |
| 290 | } |
| 291 | |
| 292 | // Timestamp |
| 293 | result.push_str(&format!( |
| 294 | "Date: {}\n", |
| 295 | self.timestamp.format("%Y-%m-%d %H:%M:%S UTC") |
| 296 | )); |
| 297 | |
| 298 | // Message |
| 299 | result.push_str(&format!("\n {}\n", self.message)); |
| 300 | |
| 301 | // Description |
| 302 | if let Some(ref desc) = self.description { |
| 303 | result.push('\n'); |
| 304 | for line in desc.lines() { |
| 305 | result.push_str(&format!(" {}\n", line)); |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | result |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | impl Default for ChangeHeader { |