Skip to main content

format

Function format 

Source
pub fn format(report: &AuditReport) -> Result<String, SsgError>
Expand description

Serialises report to a pretty-printed JSON string.

§Errors

Returns SsgError::Io when serde_json cannot serialise the report — only possible if a finding’s strings contain invalid UTF-8, which the type-system prevents in safe Rust.

§Examples

use ssg::audit::AuditReport;
use ssg::audit::output::json::format;
let report = AuditReport { gates: vec![] };
let s = format(&report).unwrap();
assert!(s.contains("\"gates\""));