Expand description
What the write direction reads a value out of.
Source is the accessors a representation has to offer and
nothing more. Every rule about a value — that a key has to name a
member, that null is neither a value nor an absence, that a bound
is enforced, that an octet of 300 is refused — lives in
crate::contract and is asked once for every representation.
§Where the line is
Two questions are the representation’s and not the contract’s, and
both are on this trait rather than in contract:
- How an integer is spelled. A JSON number is a double, so a
64-bit integer written as one says a different number than its
author typed and every reader of the file agrees on the wrong one.
That is a fact about JSON, not about IDL, so
Source::as_integeris where a representation states its own rule. - How a value renders.
Source::renderis the one form two implementations’ values can be compared in, and what “one form” means depends on what the values are written in.
Everything else — the range of an octet, the width of a char,
the bound of a sequence — is the type’s and is asked in one place.
Structs§
- Fields
- The named fields of a value that has been checked to have them.
Traits§
- Source
- A value the write direction can be executed against.