Skip to main content

Crate facet_value_format

Crate facet_value_format 

Source
Expand description

Serialize any type implementing Facet into a facet_value::Value.

This crate hosts the adapter between facet-format’s event serializer model and facet-value’s dynamic Value type.

§Example

use facet::Facet;
use facet_value::{Value, from_value};
use facet_value_format::to_value;

#[derive(Debug, Facet, PartialEq)]
struct Person {
    name: String,
    age: u32,
}

let person = Person { name: "Alice".into(), age: 30 };
let value: Value = to_value(&person).unwrap();

let person2: Person = from_value(value).unwrap();
assert_eq!(person, person2);

Structs§

ToValueError
Error type for Value serialization.

Functions§

peek_to_value
Serialize a Peek instance into a Value.
to_value
Serialize a value implementing Facet into a Value.