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
// SPDX-License-Identifier: Apache-2.0
// Copyright 2026 ZeroDDS Contributors
//! The C column's encoder: [`crate::emit::encode`] bound to the C
//! backend.
//!
//! The walk moved to `emit/encode.rs` when it stopped being C's alone.
//! What is left here is the binding, and it is a module rather than four
//! turbofishes at each call site because the C generator asks for these
//! by name in twenty places and a `::<C>` at each is twenty chances to
//! reach for the wrong backend.
//!
//! What C forces that the walk does not decide:
//!
//! - **A pointer parameter.** A codec takes `const T *v` and reaches its
//! members with `->`. Every target spells that its own way, and
//! [`crate::emit::CodecTarget::member`] is where.
//! - **An array parameter decays.** An array codec takes the array
//! itself, not its address: C adjusts an array parameter to a pointer
//! to its first element, and `(*v)[i][j]` would otherwise need
//! parentheses the tree has no node for. So a call site passes
//! `v->grid` for an array and `&v->x` for everything else.
//! - **Prototypes ahead of bodies**, so a recursive or mutually
//! recursive type does not depend on the order the walk visited its
//! types in.
use crateC;
use crateencode;
use crateEncodeError;
use ;
use Id;
use ;
use c;
pub use crateCodecOptions as CCodecOptions;
/// Build the C encoder for every type in the model, under one plan.
///
/// # Errors
/// As [`encode::codec`].
/// The C encoder for the types one root reaches, and no others.
///
/// # Errors
/// As [`encode::codec_from`].
/// The C key holder for a keyed type, and nothing for one with no `@key`.
///
/// # Errors
/// As [`encode::key_holder`].
/// The name of the C encoder function for a type.
///
/// zerodds-lint: recursion-depth 1 — this does not recurse. The callee
/// is `encode::codec_name::<C>`; `dds_bounded_recursion` compares only the last
/// segment of a call path, so it reads as a self-call.
/// Whether the C codec generated for `id` may legitimately have no
/// caller. See `encode::maybe_unused`.
///
/// zerodds-lint: recursion-depth 1 — this does not recurse. The callee
/// is `encode::maybe_unused`; `dds_bounded_recursion` compares only the last
/// segment of a call path, so it reads as a self-call.