F2S6XETO6DQ4447O4WPAHISGTBRVWW2WZYJ633KKYWWYKW5GXBPQC
struct LogEntry {
#[serde(skip_serializing_if = "Option::is_none")]
hash: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
state: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
authors: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
#[serde(skip_serializing_if = "Option::is_none")]
message: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
description: Option<String>,
#[serde(untagged)]
enum LogEntry {
Full {
#[serde(skip_serializing_if = "Option::is_none")]
hash: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
state: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
authors: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
#[serde(skip_serializing_if = "Option::is_none")]
message: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
description: Option<String>,
},
Hash(libpijul::Hash),
if let Some(ref h) = self.hash {
writeln!(f, "Change {}", h)?;
}
if let Some(ref authors) = self.authors {
write!(f, "Author: ")?;
let mut is_first = true;
for a in authors.iter() {
if is_first {
is_first = false;
write!(f, "{}", a)?;
} else {
write!(f, ", {}", a)?;
match self {
LogEntry::Full {
hash,
state,
authors,
timestamp,
message,
description,
} => {
if let Some(ref h) = hash {
writeln!(f, "Change {}", h)?;
}
if let Some(ref authors) = authors {
write!(f, "Author: ")?;
let mut is_first = true;
for a in authors.iter() {
if is_first {
is_first = false;
write!(f, "{}", a)?;
} else {
write!(f, ", {}", a)?;
}
}
// Write a linebreak after finishing the list of authors.
writeln!(f)?;
}
if let Some(ref timestamp) = timestamp {
writeln!(f, "Date: {}", timestamp)?;
}
if let Some(ref mrk) = state {
writeln!(f, "State: {}", mrk)?;
}
if let Some(ref message) = message {
writeln!(f, "\n {}\n", message)?;
}
if let Some(ref description) = description {
writeln!(f, "\n {}\n", description)?;
if let Some(ref timestamp) = self.timestamp {
writeln!(f, "Date: {}", timestamp)?;
}
if let Some(ref mrk) = self.state {
writeln!(f, "State: {}", mrk)?;
}
if let Some(ref message) = self.message {
writeln!(f, "\n {}\n", message)?;
}
if let Some(ref description) = self.description {
writeln!(f, "\n {}\n", description)?;
}