Skip to main content

facet_reflect/
lib.rs

1//! TeamDman-maintained fork of [facet-reflect](https://github.com/facet-rs/facet/tree/65bae5c31a7ce401bc44630fb96250ea884cfd3e/facet-reflect), published as
2//! [teamy-facet-reflect](https://crates.io/crates/teamy-facet-reflect).
3//! This fork uses its own Facet crate identities; use matching Teamy packages.
4//! Upstream MIT OR Apache-2.0 licensing and attribution are retained.
5//! See the [release notes](https://github.com/TeamDman/facet/blob/teamy-main/TEAMY_RELEASE.md).
6//!
7#![cfg_attr(not(feature = "std"), no_std)]
8#![warn(missing_docs)]
9#![warn(clippy::std_instead_of_core)]
10#![warn(clippy::std_instead_of_alloc)]
11//!
12//! [![crates.io](https://img.shields.io/crates/v/teamy-facet-reflect.svg)](https://crates.io/crates/teamy-facet-reflect)
13//! [![documentation](https://docs.rs/teamy-facet-reflect/badge.svg)](https://docs.rs/teamy-facet-reflect)
14//! [![MIT/Apache-2.0 licensed](https://img.shields.io/crates/l/teamy-facet-reflect.svg)](./LICENSE-MIT)
15//! [![Discord](https://img.shields.io/discord/1379550208551026748?logo=discord&label=discord)](https://discord.gg/JhD7CwCJ8F)
16//!
17//!
18//! Whereas the core `facet` crate provides essential traits like `Facet` itself, and
19//! data structures like `Type`, `StructType`, `Field`, etc., `facet-reflect` uses that
20//! information about the shape of types to allow:
21//!
22//!   * Read-only access to already-initialized values (via [`Peek`])
23//!   * Construction of values from scratch (via [`Partial`])
24//!
25//! This allows, respectively, serialization and deserialization, without risking breaking
26//! invariants in types that implement `Facet`.
27//!
28#![doc = include_str!("../readme-footer.md")]
29
30extern crate alloc;
31
32#[cfg(doc)]
33pub mod deferred_materialization;
34
35mod error;
36pub use error::*;
37
38#[cfg(feature = "alloc")]
39mod partial;
40#[cfg(feature = "alloc")]
41pub use partial::*;
42
43#[cfg(feature = "alloc")]
44mod resolution;
45#[cfg(feature = "alloc")]
46pub use resolution::*;
47
48mod peek;
49pub use peek::*;
50
51mod poke;
52pub use poke::*;
53
54mod scalar;
55pub use scalar::*;
56
57mod spanned;
58pub use spanned::{Span, get_metadata_container_value_shape};
59
60#[cfg(feature = "tracing")]
61#[allow(unused_imports)]
62pub(crate) use tracing::{debug, trace};
63
64#[cfg(not(feature = "tracing"))]
65#[macro_export]
66/// Forwards to tracing::trace when the tracing feature is enabled
67macro_rules! trace {
68    ($($tt:tt)*) => {};
69}
70#[cfg(not(feature = "tracing"))]
71#[macro_export]
72/// Forwards to tracing::debug when the tracing feature is enabled
73macro_rules! debug {
74    ($($tt:tt)*) => {};
75}