Expand description
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.
Structs§
- Aggregate
- An aggregate under construction.
Traits§
- Sink
- A value the read direction can be built into.