facet_reflect/lib.rs
1#![cfg_attr(not(feature = "std"), no_std)]
2#![warn(missing_docs)]
3#![warn(clippy::std_instead_of_core)]
4#![warn(clippy::std_instead_of_alloc)]
5//!
6//! [](https://coveralls.io/github/facet-rs/facet?branch=main)
7//! [](https://crates.io/crates/facet-reflect)
8//! [](https://docs.rs/facet-reflect)
9//! [](./LICENSE)
10//! [](https://discord.gg/JhD7CwCJ8F)
11//!
12//!
13//! Whereas the core `facet` crate provides essential traits like `Facet` itself, and
14//! data structures like `Type`, `StructType`, `Field`, etc., `facet-reflect` uses that
15//! information about the shape of types to allow:
16//!
17//! * Read-only access to already-initialized values (via [`Peek`])
18//! * Construction of values from scratch (via [`Partial`])
19//!
20//! This allows, respectively, serialization and deserialization, without risking breaking
21//! invariants in types that implement `Facet`.
22//!
23#![doc = include_str!("../readme-footer.md")]
24
25extern crate alloc;
26
27#[cfg(doc)]
28pub mod deferred_materialization;
29
30mod error;
31pub use error::*;
32
33#[cfg(feature = "alloc")]
34mod partial;
35#[cfg(feature = "alloc")]
36pub use partial::*;
37
38#[cfg(feature = "alloc")]
39mod resolution;
40#[cfg(feature = "alloc")]
41pub use resolution::*;
42
43mod peek;
44pub use peek::*;
45
46mod poke;
47pub use poke::*;
48
49mod scalar;
50pub use scalar::*;
51
52mod spanned;
53pub use spanned::{Span, get_metadata_container_value_shape};
54
55#[cfg(feature = "tracing")]
56#[allow(unused_imports)]
57pub(crate) use tracing::{debug, trace};
58
59#[cfg(not(feature = "tracing"))]
60#[macro_export]
61/// Forwards to tracing::trace when the tracing feature is enabled
62macro_rules! trace {
63 ($($tt:tt)*) => {};
64}
65#[cfg(not(feature = "tracing"))]
66#[macro_export]
67/// Forwards to tracing::debug when the tracing feature is enabled
68macro_rules! debug {
69 ($($tt:tt)*) => {};
70}