An open API service indexing awesome lists of open source software.

https://github.com/facet-rs/facet

Rust reflection, serialization, deserialization — know the shape of your types
https://github.com/facet-rs/facet

deserialization rust rust-lang serialization

Last synced: 8 months ago
JSON representation

Rust reflection, serialization, deserialization — know the shape of your types

Awesome Lists containing this project

README

          

# facet

[![experimental](https://img.shields.io/badge/status-highly%20experimental-orange)](https://github.com/fasterthanlime/facet)
[![free of syn](https://img.shields.io/badge/free%20of-syn-hotpink)](https://github.com/fasterthanlime/free-of-syn)
[![crates.io](https://img.shields.io/crates/v/facet.svg)](https://crates.io/crates/facet)
[![documentation](https://docs.rs/facet/badge.svg)](https://docs.rs/facet)
[![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/facet.svg)](./LICENSE)

Thanks to all individual and corporate sponsors, without whom this work could not exist:




Ko-fi




GitHub Sponsors




Patreon

         


Zed


facet provides type reflection for Rust, in const contexts.

Any type that implements `Facet` trait returns a `Shape`, which describes:

* The memory layout of the type
* Its definition: struct fields, underlying type for newtypes, etc.
* How to drop it in place

The `Poke` type is able to allocate (or work from a `&mut MaybeUninit`)
any Facet type, and gradually initialize its fields — until the fully-built
value is moved out of the partial.

The `Peek` type helps perform read operations on any Facet type.

It comes with a derive macro that uses [unsynn](https://crates.io/crates/unsynn)
for speed of compilation.

## Ecosystem

There are separate crates for the trait, the core types, the derive macro, peek, poke,
and various serializers, deserializers, and pretty printers etc.

The hub for everything is the [facet](https://crates.io/crates/facet) crate.

You can start with its [README](https://github.com/facet-rs/facet/blob/main/facet/README.md).

## 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.