Architecture

Crate graph

┌─────────────────────────────────────────────────────────────────┐
│                         User Code                               │
│                    #[derive(Facet)]                             │
└─────────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────────┐
│                          facet                                  │
│              Re-exports from core + macros + reflect            │
└─────────────────────────────────────────────────────────────────┘
          │                   │                   │
          ▼                   ▼                   ▼
┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐
│   facet-core    │  │  facet-macros   │  │ facet-reflect   │
│                 │  │                 │  │                 │
│ • Facet trait   │  │ • #[derive]     │  │ • Peek (read)   │
│ • Shape         │  │ • Proc macros   │  │ • Partial (build)│
│ • Def, Type     │  │                 │  │                 │
│ • VTables       │  │        │        │  │                 │
│ • no_std        │  │        ▼        │  │                 │
└─────────────────┘  │ facet-macros-   │  └─────────────────┘
                     │ impl            │           │
                     │                 │           │
                     │ • unsynn parser │           │
                     │ • Code gen      │           │
                     └─────────────────┘           │
                                                   │
                              ┌────────────────────┘
                              ▼
┌─────────────────────────────────────────────────────────────────┐
│              Format Crates & Utility Crates                     │
│  facet-json, facet-yaml, facet-kdl, facet-toml, facet-args      │
│  facet-pretty, facet-diff, facet-assert, facet-value            │
└─────────────────────────────────────────────────────────────────┘

Format crates and utility crates primarily interact with facet-reflect — they use Peek to read values and Partial to build them.

Key crates

CratePurpose
facet-coreCore types: Facet trait, Shape, Def, vtables. Supports no_std.
facet-macrosThe #[derive(Facet)] proc macro (thin wrapper).
facet-macros-implActual derive implementation using unsynn.
facet-reflectHigh-level reflection: Peek for reading, Partial for building.
facetUmbrella crate that re-exports everything.