| Crates.io | facet-value |
| lib.rs | facet-value |
| version | 0.43.2 |
| created_at | 2025-12-11 16:24:34.359821+00 |
| updated_at | 2026-01-23 18:02:43.013835+00 |
| description | Memory-efficient dynamic value type for facet, supporting JSON-like data plus bytes |
| homepage | https://facet.rs |
| repository | https://github.com/facet-rs/facet |
| max_upload_size | |
| id | 1980036 |
| size | 313,151 |
A memory-efficient dynamic value type for representing structured data, with support for bytes.
Value is exactly one pointer in size using tagged pointersValue and any type implementing Facetuse facet::Facet;
use facet_value::{Value, to_value, from_value};
#[derive(Debug, Facet, PartialEq)]
struct Person {
name: String,
age: u32,
}
// Convert a typed value to a dynamic Value
let person = Person { name: "Alice".into(), age: 30 };
let value: Value = to_value(&person).unwrap();
// Inspect the value dynamically
let obj = value.as_object().unwrap();
assert_eq!(obj.get("name").unwrap().as_string().unwrap().as_str(), "Alice");
// Convert back to a typed value
let person2: Person = from_value(value).unwrap();
assert_eq!(person, person2);
Thanks to all individual sponsors:
...along with corporate sponsors:
...without whom this work could not exist.
The facet logo was drawn by Misiasart.
Licensed under either of:
at your option.