pub fn to_vec_pretty<'facet, T>(
value: &T,
) -> Result<Vec<u8>, SerializeError<JsonSerializeError>>Expand description
Serialize a value to pretty-printed JSON bytes.
ยงExample
use facet::Facet;
use facet_json::to_vec_pretty;
#[derive(Facet)]
struct Point { x: i32, y: i32 }
let point = Point { x: 10, y: 20 };
let bytes = to_vec_pretty(&point).unwrap();
assert!(bytes.contains(&b'\n'));