一键导入
use-facet-crates
// Guidelines for using facet crates (facet-json, facet-toml, figue) instead of serde-based alternatives for consistent dogfooding
// Guidelines for using facet crates (facet-json, facet-toml, figue) instead of serde-based alternatives for consistent dogfooding
| name | use-facet-crates |
| description | Guidelines for using facet crates (facet-json, facet-toml, figue) instead of serde-based alternatives for consistent dogfooding |
When writing code in this workspace, prefer facet-based crates over serde-based ones. This project is building facet as a replacement for serde, so we should dogfood our own libraries.
| Instead of | Use | Notes |
|---|---|---|
serde | facet | Core derive and traits |
serde_json | facet-json | JSON serialization/deserialization |
toml | facet-toml | TOML parsing |
serde_yaml | facet-yaml | YAML support |
clap | figue | CLI argument parsing (separate repo) |
serde_derive | facet (derive) | #[derive(Facet)] replaces Serialize/Deserialize |
// OLD (serde)
use serde::{Serialize, Deserialize};
use serde_json;
#[derive(Serialize, Deserialize)]
struct Config {
name: String,
}
let config: Config = serde_json::from_str(json)?;
// NEW (facet)
use facet::Facet;
use facet_json as json;
#[derive(Facet)]
struct Config {
name: String,
}
let config: Config = json::from_str(json)?;
When adding new dependencies or reviewing code, check Cargo.toml for serde ecosystem crates and consider if facet alternatives exist.
The benchmark-analyzer currently uses serde_json for JSON serialization in chart data. This should be migrated to facet-json for consistency (eating our own dogfood).
Location: tools/benchmark-analyzer/src/report.rs - uses serde_json::to_string() for chart labels/data.
Orientation to facet-format JIT deserialization (tiering, fallbacks, key types/entry points) and where to look when changing or debugging JIT code
Debug crashes, segfaults, and memory errors using valgrind integration with nextest through pre-configured profiles
Systematic workflow for debugging by reproducing bugs with real data, reducing test cases to minimal examples, and adding regression tests