Skip to main content

facet_format/
lib.rs

1#![cfg_attr(not(feature = "jit"), deny(unsafe_code))]
2#![deny(missing_docs, rustdoc::broken_intra_doc_links)]
3#![allow(unused_macros)]
4
5//! Prototype types for the format deserializer.
6
7/// Trace-level logging macro that forwards to `tracing::trace!` when the `tracing` feature is enabled.
8///
9/// When the `tracing` feature is disabled, this expands to nothing.
10#[cfg(feature = "tracing")]
11macro_rules! trace {
12    ($($arg:tt)*) => {
13        ::tracing::trace!($($arg)*)
14    };
15}
16
17/// Trace-level logging macro (no-op when `tracing` feature is disabled).
18#[cfg(not(feature = "tracing"))]
19macro_rules! trace {
20    ($($arg:tt)*) => {};
21}
22
23/// Debug-level logging macro that forwards to `tracing::debug!` when the `tracing` feature is enabled.
24///
25/// When the `tracing` feature is disabled, this expands to nothing.
26#[cfg(feature = "tracing")]
27#[allow(unused_macros)]
28macro_rules! debug {
29    ($($arg:tt)*) => {
30        ::tracing::debug!($($arg)*)
31    };
32}
33
34/// Debug-level logging macro (no-op when `tracing` feature is disabled).
35#[cfg(not(feature = "tracing"))]
36#[allow(unused_macros)]
37macro_rules! debug {
38    ($($arg:tt)*) => {};
39}
40
41#[allow(unused_imports)]
42pub(crate) use debug;
43#[allow(unused_imports)]
44pub(crate) use trace;
45
46mod deserializer;
47mod event;
48mod evidence;
49mod parser;
50mod serializer;
51mod solver;
52mod visitor;
53
54#[cfg(feature = "jit")]
55pub mod jit;
56
57pub use deserializer::{DeserializeError, FormatDeserializer};
58pub use event::{
59    ContainerKind, FieldKey, FieldLocationHint, ParseEvent, ScalarValue, ValueTypeHint,
60};
61pub use evidence::FieldEvidence;
62#[cfg(feature = "jit")]
63pub use parser::FormatJitParser;
64pub use parser::{EnumVariantHint, FormatParser, ProbeStream, ScalarTypeHint};
65pub use serializer::{
66    DynamicValueEncoding, DynamicValueTag, EnumVariantEncoding, FieldOrdering, FormatSerializer,
67    MapEncoding, SerializeError, StructFieldMode, serialize_root, serialize_value_with_shape,
68};
69pub use solver::{SolveOutcome, SolveVariantError, solve_variant};
70pub use visitor::{FieldMatch, StructFieldTracker};