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
//! Swift code generation.
//!
//! This module translates a [`Registry`](crate::Registry) of reflected type
//! definitions into idiomatic Swift source code.
//!
//! # Submodules (in pipeline order)
//!
//! 1. **[`generator`]** — Top-level orchestrator. [`CodeGenerator`] implements
//! [`CodeGen`](super::CodeGen) to produce a complete Swift source file from a
//! registry. It resolves qualified type names against the configuration
//! (external packages, namespaces) and then delegates writing to the emitter
//! layer.
//!
//! 2. **[`emitter`]** — AST-to-source rendering. Implements
//! [`Emitter<Swift>`](super::Emitter) for each AST node type
//! ([`Module`](super::module::Module), [`Container`](super::Container),
//! `Named<Format>`, `Format`, `Doc`). This is where the Swift language
//! mapping lives: type names, `Serializer`/`Deserializer` protocol methods,
//! `public struct` / `indirect public enum` selection, and bincode
//! serialize/deserialize method generation. Feature helpers (`ListOfT`,
//! `SetOfT`, etc.) are embedded as `include_bytes!` snippets and emitted as
//! needed.
//!
//! 3. **[`installer`]** — Project scaffolding. [`Installer`] implements
//! [`SourceInstaller`](super::SourceInstaller) to write a ready-to-build
//! Swift package: it copies serde runtime sources, splits the registry by
//! namespace into per-module files, and generates a `Package.swift` manifest
//! with SPM targets.
pub
pub use CodeGenerator;
pub use Installer;
/// Normalize a path string for use in Swift string literals.
/// On Windows, replaces backslashes with forward slashes to avoid
/// Swift interpreting them as escape sequences.