pub fn serialise_output<T: ?Sized>(value: &T, fmt: OutputFmt) -> String
where
    T: Serialize,
{
    match fmt {
        OutputFmt::Yaml => serde_yaml::to_string(&value)
            .unwrap_or_else(|_| "Failed to serialise output to yaml".to_string()),
        OutputFmt::Json => serde_json::to_string_pretty(&value)
            .unwrap_or_else(|_| "Failed to serialise output to json".to_string()),
        OutputFmt::JsonCompact => serde_json::to_string(&value)
            .unwrap_or_else(|_| "Failed to serialise output to compact json".to_string()),
        OutputFmt::Pretty => {
            "OutputFmt::Pretty' not handled by caller, in serialise_output()".to_string()
        }
    }
}
// serialize structured value using any format from OutputFmt
// except OutputFmt::Pretty, which must be handled by caller.
serialize structured value using any format from OutputFmt
except OutputFmt::Pretty, which must be handled by caller.
serialize structured value using any format from OutputFmt except OutputFmt :: Pretty which must be handled by caller .
pub fn serialise_output<T: ?Sized>(value: &T, fmt: OutputFmt) -> String
where
    T: Serialize,
{
    match fmt {
        OutputFmt::Yaml => serde_yaml::to_string(&value)
            .unwrap_or_else(|_| "Failed to serialise output to yaml".to_string()),
        OutputFmt::Json => serde_json::to_string_pretty(&value)
            .unwrap_or_else(|_| "Failed to serialise output to json".to_string()),
        OutputFmt::JsonCompact => serde_json::to_string(&value)
            .unwrap_or_else(|_| "Failed to serialise output to compact json".to_string()),
        OutputFmt::Pretty => {
            "OutputFmt::Pretty' not handled by caller, in serialise_output()".to_string()
        }
    }
}
pub fn serialise_output < T : ? Sized > ( value : & T , fmt : OutputFmt ) -> String where T : Serialize , { match fmt { OutputFmt :: Yaml => serde_yaml :: to_string ( & value ) . unwrap_or_else ( | _ | " " . to_string ( ) ) , OutputFmt :: Json => serde_json :: to_string_pretty ( & value ) . unwrap_or_else ( | _ | " " . to_string ( ) ) , OutputFmt :: JsonCompact => serde_json :: to_string ( & value ) . unwrap_or_else ( | _ | " " . to_string ( ) ) , OutputFmt :: Pretty => { " " . to_string ( ) } } }
serialize structured value using any format from OutputFmt
except OutputFmt::Pretty, which must be handled by caller.
serialize structured value using any format from OutputFmt except OutputFmt :: Pretty which must be handled by caller .
value
&T
fmt
OutputFmt
value
&T
fmt
OutputFmt