pub fn emit(content: &str, writer: impl Write) -> Result<()>Expand description
Write rendered output to a writer.
This function writes the rendered content to any type implementing
std::io::Write, such as files or stdout.
§Parameters
content: The rendered content to writewriter: Any type implementingWrite
§Returns
Ok(())on successErr(std::io::Error)if writing fails
§Example
use secreport::render::emit;
let content = "Security Report\n===============";
let mut output = Vec::new();
emit(content, &mut output).unwrap();
assert_eq!(String::from_utf8(output).unwrap(), content);Writing to stdout:
use secreport::render::emit;
use std::io;
emit("Report complete!\n", io::stdout())?;