Skip to main content

cc_switch_lib/cli/ui/
formatters.rs

1use serde::Serialize;
2
3pub fn to_json<T: Serialize>(value: &T) -> Result<String, serde_json::Error> {
4    serde_json::to_string_pretty(value)
5}
6
7pub fn format_bool(value: bool) -> &'static str {
8    if value {
9        "✓"
10    } else {
11        "✗"
12    }
13}