Apache License 2.0

项目介绍

facet-rs/facet 是一个托管在 GitHub 上的开源项目,主要使用 Rust 编写,采用 Apache License 2.0 许可证,目前获得 2.6k 个 Star、133 次 Fork。

仓库全名
facet-rs/facet
开源许可证
Apache License 2.0
Star 数
2.6k
Fork 数
133
未关闭 Issue
159

README 摘要

facet facet is an ecosystem of Rust crates built on runtime reflection. The core crates give types a 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,…

完整内容见 GitHub 原始 README 或本页 。

常见问题

facet 用什么语言开发?

主要使用 Rust 编写,采用 Apache License 2.0 许可证,目前有 2.6k 个 Star。

facet 可以免费商用吗?

仓库采用 Apache License 2.0 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 facet 的源码?

可以直接克隆仓库:git clone https://github.com/facet-rs/facet.git,默认分支为 main;安装与运行步骤见仓库 README。

facet 最近还在维护吗?

仓库最近一次更新为 1 天前,当前有 159 个未关闭 Issue;Star 数为 2.6k,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

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

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
2859
价值分
1585
活跃状态
活跃

语言占比

Batchfile
Dockerfile
HTML
Just
Nix
Python
RenderScript
Rust
Shell

README

facet

Coverage Status crates.io documentation MIT/Apache-2.0 licensed Discord

facet is an ecosystem of Rust crates built on runtime reflection.

The core crates give types a 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 for CLI and configuration loading
  • Styx for typed configuration documents
  • Dibs for Postgres schemas and queries
  • Phon for schema-aware binary encoding
  • Vox for cross-language RPC
  • Weavy for lowered programs and copy-patch execution
  • Snark for parser generation
  • Vixen for the Vix language and runtime

Website note

The https://facet.rs 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, 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, which implements the [Facet] derive attribute as a fast/light proc macro powered by unsynn

For struct manipulation and reflection, we have:

  • 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 a simple log logger and color-backtrace configured with the lightweight btparse backend

Ecosystem

Various crates live under the https://github.com/facet-rs umbrella, and their repositories are kept somewhat-consistent through facet-dev.

Crates are in various states of progress, buyer beware!

In terms of data formats, we have:

Still adjacent to serialization/deserialization, we have:

  • facet-urlencoded: URL-encoded form data deserialization
  • figue: CLI arguments, config files, and environment variables (external crate)

As far as utilities go:

And the less developed:

  • 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: XML/DOM ecosystem (includes facet-xml, facet-dom, facet-svg, facet-atom, facet-xml-node, facet-singularize)
  • facet-axum: Axum web framework integration

Extended cinematic universe

Some crates are developed completely independently from the facet org:

  • facet-v8 provides an experimental Facet/v8 integration
  • facet-openapi (experimental) Generates OpenAPI definitions from types that implement Facet
  • facet_generate reflects Facet types into Java, Swift and TypeScript
  • multi-array-list provides an experimental MultiArrayList type

Sponsors

Thanks to all individual sponsors:

GitHub Sponsors Patreon

…without whom this work could not exist.

Special thanks

The facet logo was drawn by Misiasart.

License

Licensed under either of:

at your option.

评论

暂无评论