1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// SPDX-License-Identifier: MIT OR Apache-2.0
// Copyright (c) 2026 Noyalib. All rights reserved.
//! Declarative builders for the public config types.
//!
//! Pairs with the chained-setter builders on [`crate::ParserConfig`]
//! and [`crate::SerializerConfig`]: each `field: value` entry is
//! translated to a call to the same-named builder method on the
//! `new()` baseline, so the result is byte-identical to writing the
//! chain by hand. Zero runtime overhead — the expansion is a single
//! struct construction the optimiser folds away.
//!
//! # Examples
//!
//! ```
//! use noyalib::parser_config;
//!
//! let cfg = parser_config! {
//! max_depth: 64,
//! strict_booleans: true,
//! };
//! assert_eq!(cfg.max_depth, 64);
//! assert!(cfg.strict_booleans);
//! ```
//!
//! ```
//! use noyalib::serializer_config;
//!
//! let cfg = serializer_config! {
//! indent: 4,
//! quote_all: true,
//! };
//! ```
//!
//! Both macros accept zero entries (yielding the same value as
//! `ParserConfig::new()` / `SerializerConfig::new()`) and a
//! trailing comma after the last entry.
/// Construct a [`crate::ParserConfig`] from a field-value list.
///
/// Equivalent to chaining the named builder methods on
/// [`crate::ParserConfig::new()`]. Empty input returns the
/// `new()` baseline. Trailing comma is permitted.
///
/// # Examples
///
/// ```
/// use noyalib::parser_config;
///
/// // Empty form — equivalent to `ParserConfig::new()`.
/// let _ = parser_config! {};
///
/// // Full chain.
/// let cfg = parser_config! {
/// max_depth: 32,
/// max_alias_expansions: 200,
/// strict_booleans: true,
/// };
/// assert_eq!(cfg.max_depth, 32);
/// assert_eq!(cfg.max_alias_expansions, 200);
/// assert!(cfg.strict_booleans);
/// ```
/// Construct a [`crate::SerializerConfig`] from a field-value list.
///
/// Equivalent to chaining the named builder methods on
/// [`crate::SerializerConfig::new()`]. Empty input returns the
/// `new()` baseline. Trailing comma is permitted.
///
/// # Examples
///
/// ```
/// use noyalib::serializer_config;
///
/// // Empty form — equivalent to `SerializerConfig::new()`.
/// let _ = serializer_config! {};
///
/// // Full chain.
/// let cfg = serializer_config! {
/// indent: 4,
/// quote_all: true,
/// };
/// ```