Serialize a value to JSON and print it to stdout, or exit with an error.
(value: &impl serde::Serialize)
| 43 | |
| 44 | /// Serialize a value to JSON and print it to stdout, or exit with an error. |
| 45 | fn 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))] |
| 56 | fn main() { |
no test coverage detected