MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / format_display

Method format_display

atomic-core/src/change/header.rs:284–310  ·  view source on GitHub ↗

Format the header for display. Returns a multi-line string suitable for showing to users.

(&self)

Source from the content-addressed store, hash-verified

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
313impl Default for ChangeHeader {

Callers 1

Calls 2

pushMethod · 0.45
linesMethod · 0.45

Tested by 1