MCPcopy Create free account
hub / github.com/PowerShell/DSC / print_json

Function print_json

resources/windows_service/src/main.rs:45–53  ·  view source on GitHub ↗

Serialize a value to JSON and print it to stdout, or exit with an error.

(value: &impl serde::Serialize)

Source from the content-addressed store, hash-verified

43
44/// Serialize a value to JSON and print it to stdout, or exit with an error.
45fn print_json(value: &impl serde::Serialize) {
46 match serde_json::to_string(value) {
47 Ok(json) => println!("{json}"),
48 Err(e) => {
49 write_error(&t!("main.invalidJson", error = e.to_string()));
50 exit(EXIT_SERVICE_ERROR);
51 }
52 }
53}
54
55#[cfg(not(windows))]
56fn main() {

Callers 1

mainFunction · 0.70

Calls 2

write_errorFunction · 0.70
to_stringFunction · 0.50

Tested by

no test coverage detected