use serde::Serialize;
#[derive(Debug, Serialize)]
pub struct Report {
pub status: &'static str,
pub files: Vec<FileReport>,
}
#[derive(Debug, Serialize)]
pub struct FileReport {
pub path: String,
pub op: &'static str,
#[serde(skip_serializing_if = "Option::is_none")]
pub moved_to: Option<String>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub hunks: Vec<HunkReport>,
}
#[derive(Debug, Serialize)]
pub struct HunkReport {
pub rung: &'static str,
pub line: usize,
#[serde(skip_serializing_if = "Option::is_none")]
pub matched: Option<Vec<String>>,
}
pub fn entry(
path: &str,
op: &'static str,
moved_to: Option<String>,
hunks: Vec<HunkReport>,
) -> FileReport {
FileReport {
path: path.to_string(),
op,
moved_to,
hunks,
}
}