pub fn peek_to_string<'input, 'facet>(
peek: Peek<'input, 'facet>,
) -> Result<String, SerializeError<JsonSerializeError>>Expand description
Serialize a Peek instance to a JSON string.
This allows serializing values without requiring ownership, useful when
you already have a Peek from reflection operations.
ยงExample
use facet::Facet;
use facet_reflect::Peek;
use facet_json::peek_to_string;
#[derive(Facet)]
struct Point { x: i32, y: i32 }
let point = Point { x: 10, y: 20 };
let json = peek_to_string(Peek::new(&point)).unwrap();
assert_eq!(json, r#"{"x":10,"y":20}"#);