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
//! Helper modules for customizing serialization and deserialization.
//!
//! This module provides utilities for controlling how certain types are
//! serialized and deserialized, particularly enums.
//!
//! # Singleton Map
//!
//! The `singleton_map` family of modules provides helpers for serializing
//! enums as single-entry maps, which is a common YAML pattern.
//!
//! ## Example
//!
//! ```rust
//! use noyalib::with::singleton_map;
//! use serde::{Deserialize, Serialize};
//!
//! #[derive(Debug, Serialize, Deserialize, PartialEq)]
//! enum Action {
//! Start { delay: u32 },
//! Stop,
//! }
//!
//! #[derive(Debug, Serialize, Deserialize, PartialEq)]
//! struct Task {
//! name: String,
//! #[serde(with = "singleton_map")]
//! action: Action,
//! }
//!
//! let task = Task {
//! name: "my-task".to_string(),
//! action: Action::Start { delay: 5 },
//! };
//!
//! let yaml = noyalib::to_string(&task).unwrap();
//! // Output:
//! // name: my-task
//! // action:
//! // Start:
//! // delay: 5
//! ```
// SPDX-License-Identifier: MIT OR Apache-2.0
// Copyright (c) 2026 Noyalib. All rights reserved.
/// Alias for `singleton_map_recursive`.
///
/// This provides compatibility with code that uses the `nested_singleton_map`
/// name.
pub use singleton_map_recursive as nested_singleton_map;