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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
// SPDX-License-Identifier: Apache-2.0
// Copyright 2026 ZeroDDS Contributors
//! What the read direction builds a value into.
//!
//! The counterpart of [`crate::source`], and the asymmetry between them
//! is real: reading a value needs accessors, building one needs
//! constructors, and a constructor has to be told *what kind of thing*
//! it is building or the representation cannot store it.
//!
//! ## Every constructor carries its type
//!
//! [`Sink::integer`], [`Sink::float`] and [`Sink::character`] all take
//! the [`PrimitiveKind`] the value came from, and none of them has to.
//! `serde_json::Value` uses it for exactly one decision — a 64-bit width
//! becomes a decimal string, because a JSON number is a double and loses
//! the low bits past 2^53 — and could have made that decision from the
//! magnitude instead. It does not, because a form that changed shape at
//! 2^53 would compare unequal across the boundary, and because a
//! representation that stores an `int16` differently from an `int32`
//! must be *told* which it has rather than left to infer it from a value
//! that fits both.
//!
//! This is the hazard the module note in [`crate`] names, in its
//! constructor form: a coordinate the current implementation happens not
//! to need is still a coordinate, and dropping it from the signature is
//! what makes the next implementation guess.
use crateProbeError;
use String;
use Vec;
use PrimitiveKind;
use Float128;
/// A value the read direction can be built into.
///
/// `Clone` because Table 9's default for an array is "the same
/// dimensions and same element type whose elements take the default
/// value for their corresponding type": the default of a type does not
/// depend on the index, so one element is built and cloned rather than
/// the model walked once per element — a 4096-element array of a nested
/// structure would otherwise be 4096 identical walks.
/// An aggregate under construction.
///
/// The read direction does not build a structure in one go: a
/// `@mutable` type is driven by the headers the writer wrote, in
/// whatever order it wrote them, and the members the stream left out
/// take their defaults afterwards. So the value is assembled by name,
/// and the two things the assembly has to answer are whether a member
/// is already in — §7.4.1.2.3's defaulting asks it — and whether one
/// arrived twice, which is a stream this type does not describe.
///
/// Insertion order is preserved and a repeat replaces in place, which
/// is `serde_json::Map::insert`'s contract and the one the two
/// `@mutable` readers were written against.