Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
F

facet

> 编程语言
Open source

Rust reflection, serialization, deserialization, pretty printing, etc. — the last proc macro you should need

2.6K stars0 likes0 views
WebsiteGitHub

About

Rust reflection, serialization, deserialization, pretty printing, etc. — the last proc macro you should need

# facet `facet` is an ecosystem of Rust crates built on runtime reflection. The core crates give types a [`SHAPE`](Facet::SHAPE) associated constant with their kind, layout, fields, documentation, attributes, and type-specific operations. `facet-reflect` builds, reads, and mutates values through those shapes while preserving their invariants. Serialization and integration crates build on that reflection layer: JSON, TOML, YAML, MessagePack, Postcard, ASN.1, XDR, CSV, XML, URL-encoded forms, SQLite, Axum, schema generation, structural diffing, and more. Some related projects now live in their own repositories: - [Figue](https://github.com/bearcove/figue) for CLI and configuration loading - [Styx](https://github.com/bearcove/styx) for typed configuration documents - [Dibs](https://github.com/bearcove/dibs) for Postgres schemas and queries - [Phon](https://github.com/bearcove/phon) for schema-aware binary encoding - [Vox](https://github.com/bearcove/vox) for cross-language RPC - [Weavy](https://github.com/bearcove/weavy) for lowered programs and copy-patch execution - [Snark](https://github.com/bearcove/snark) for parser generation - [Vixen](https://github.com/vixenware/vixen) for the Vix language and runtime ## Website note The website has a lot of information about a lot of the ecosystem but it's unfortunately not super reliable as LLMs have been doing too much of the writing (on account on Amos being burned out). This is being slowly repaired. Bear with us. ## Workspace contents The main `facet` crate re-exports symbols from: - [facet-core](https://github.com/facet-rs/facet/tree/main/facet-core), which defines the main components: - The [`Facet`] trait and implementations for foreign types (mostly `libstd`) - The [`Shape`] struct along with various vtables and the whole [`Def`] tree - Type-erased pointer helpers like [`PtrUninit`], [`PtrConst`], and [`Opaque`] - Autoderef specialization trick needed for `facet-macros` - [facet-macros](https://github.com/facet-rs/facet/tree/main/facet-macros), which implements the [`Facet`] derive attribute as a fast/light proc macro powered by [unsynn](https://docs.rs/unsynn) For struct manipulation and reflection, we have: - [facet-reflect](https://github.com/facet-rs/facet/tree/main/facet-reflect), allows building values of arbitrary shapes in safe code, respecting invariants. It also allows peeking at existing values. Internal crates include: - [facet-testhelpers](https://github.com/facet-rs/facet/tree/main/facet-testhelpers) a simple log logger and color-backtrace configured with the lightweight btparse backend ## Ecosystem Various crates live under the umbrella, and their repositories are kept somewhat-consistent through [facet-dev](https://github.com/facet-rs/facet-dev). Crates are in various states of progress, buyer beware! In terms of data formats, we have: - [facet-json](https://github.com/facet-rs/facet-format/tree/main/facet-json): JSON format support - [facet-toml](https://github.com/facet-rs/facet-format/tree/main/facet-toml): TOML format support - [facet-yaml](https://github.com/facet-rs/facet-format/tree/main/facet-yaml): YAML format support - [facet-msgpack](https://github.com/facet-rs/facet-format/tree/main/facet-msgpack): MessagePack deserialization - [facet-asn1](https://github.com/facet-rs/facet-format/tree/main/facet-asn1): ASN.1 format support - [facet-xdr](https://github.com/facet-rs/facet-format/tree/main/facet-xdr): XDR format support - [facet-csv](https://github.com/facet-rs/facet-format/tree/main/facet-csv): CSV format support - [facet-xml](https://github.com/facet-rs/facet-format/tree/main/facet-xml): XML format support Still adjacent to serialization/deserialization, we have: - [facet-urlencoded](https://github.com/facet-rs/facet/tree/main/facet-urlencoded): URL-encoded form data deserialization - [figue](https://github.com/bearcove/figue): CLI arguments, config files, and environment variables (external crate) As far as utilities go: - [facet-value](https://github.com/facet-rs/facet/tree/main/facet-value): Memory-efficient dynamic value type, supporting JSON-like data plus bytes - [facet-pretty](https://github.com/facet-rs/facet/tree/main/facet-pretty): Pretty-print Facet types - [facet-diff](https://github.com/facet-rs/facet/tree/main/facet-diff): Diffing capabilities for Facet types - [facet-assert](https://github.com/facet-rs/facet/tree/main/facet-assert): Pretty assertions for Facet types (no PartialEq required) - [facet-serialize](https://github.com/facet-rs/facet-serialize): Generic iterative serialization facilities - [facet-deserialize](https://github.com/facet-rs/facet-deserialize): Generic iterative deserialization facilities And the less developed: - [facet-inspect](https://github.com/facet-rs/facet-inspect): Utilities to inspect the content of a Facet object ## Previously separate crates These crates previously lived in separate repositories and now live in this monorepo: - [facet-xml](https://github.com/facet-rs/facet-format/tree/main/facet-xml): XML/DOM ecosystem (includes facet-xml, facet-dom, facet-svg, facet-atom, facet-xml-node, facet-singularize) - [facet-axum](https://github.com/facet-rs/facet-axum): Axum web framework integration ## Extended cinematic universe Some crates are developed completely independently from the facet org: - [facet-v8](https://github.com/simonask/facet-v8) provides an experimental Facet/v8 integration - [facet-openapi](https://github.com/ThouCheese/facet-openapi) (experimental) Generates OpenAPI definitions from types that implement Facet - [facet_generate](https://github.com/redbadger/facet-generate) reflects Facet types into Java, Swift and TypeScript - [multi-array-list](https://lib.rs/crates/multi-array-list) provides an experimental `MultiArrayList` type ## Sponsors Thanks to all individual sponsors:

...without whom this work could not exist. ## Special thanks The facet logo was drawn by [Misiasart](https://misiasart.com/). ## License Licensed under either of: - Apache License, Version 2.0 ([LICENSE-APACHE](https://github.com/facet-rs/facet/blob/main/LICENSE-APACHE) or ) - MIT license ([LICENSE-MIT](https://github.com/facet-rs/facet/blob/main/LICENSE-MIT) or ) at your option.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustdebuggingdeserializationintrospectionreflection

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言