apo 0.1.0

APO — Engineering Evidence Platform. Repository Hygiene analyzer.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! JSON report writer.

use std::path::Path;

use crate::error::Result;
use crate::report::Report;

pub fn write_json(report: &Report, path: &Path) -> Result<()> {
    let file = std::fs::File::create(path)?;
    serde_json::to_writer_pretty(file, report)?;
    Ok(())
}

/// Serialize a report to a pretty JSON string.
pub fn to_string(report: &Report) -> Result<String> {
    Ok(serde_json::to_string_pretty(report)?)
}