Skip to main content

Module contract

Module contract 

Source
Expand description

What a value file means, in one place.

Three backends read the same value file: crate::encode() turns it into bytes, zerodds_wire_probe::fill into C for Cyclone and RTI, and zerodds_wire_probe::fill_cpp into C++ for Fast DDS. Every question about the file — is this key a member, may it be null, is this integer expressible, which members does this aggregate have — has to be answered the same way by all three, because a difference is a difference in the sample and the matrix would read it as a difference in the serialisers.

The two backends that are not here still call these functions: the rules are generic over Source and every one of them is monomorphised at the same serde_json::Value the encoder uses. A backend that lived in a different crate and re-derived the rules would be back where defect 11 was.

They agreed once by inspection and diverged twice by edit. Defect 11 of docs/silent-drop-sweep.md is one half of that divergence: the C emitter walked members_of where the other two walked all_members_of, so a derived type’s base members were never filled and the vendor serialised a structure of the right length with zeros in it. Nothing said so, because each backend held its own copy of the rule.

So the rules live here and the backends call them. A rule that is only in one backend is a rule the other two can contradict.

§What is recorded

Sharing the decisions is half of it; the other half is checking that the backends actually reach the same parts of the value. Each backend threads a Consumed and pushes the path of every scalar it reads out of the document. Two backends that accept the same file and consumed different paths disagree about what the sample is, whatever their exit codes said. tests/probe_agreement.rs is what compares them.

Structs§

Case
One case member of a union.
Consumed
Where each backend read a scalar out of the value document.
Member
One member of an aggregate, as all three backends see it.
UnevaluatedLabel
A case label whose constant expression the model cannot evaluate.

Constants§

MAX_ALIAS_HOPS
How many typedefs one chain may hop through before it is taken for a cycle.

Functions§

array
An array.
array_dimensions
The element counts of an array’s dimensions.
bit_names
The bit names a bitmask value sets, each with its position.
bitfield_names
The names of a bitset’s own bitfields, anonymous padding excluded.
boolean
true or false.
bounded_items
The elements of a collection, with its declared bound enforced.
character
Exactly one character.
character_for
Exactly one character, of a width that can carry it.
discriminator
A union’s discriminator value, which is never absent.
discriminator_c_width
How a union’s switch and its case labels have to be spelled in C and C++.
enumerator
The enumerator a value names, and its effective value.
float
A floating-point value.
float128
A long double.
integer
An integer, in whatever spelling the representation admits.
integer_for
An integer that fits the primitive it is destined for.
join
<path>.<name>, or <name> at the root of a nameless walk.
kind_of
The kind a value has, for a refusal that says what was there.
map_entry
The key and the value of one map entry.
member_value
The value for one member, or None where an @optional is absent.
members
Every member an aggregate has, a base’s before its own.
object
An object.
reject_alias_cycle
Refuse a model whose typedefs close a cycle, before any walk follows one.
reject_null
Refuse null wherever a value belongs.
reject_unknown_keys
Refuse a key that names nothing the type declares.
resolve_alias
Whether type_ is one of the two aggregates a JSON object stands for, once typedefs are seen through.
root_path
The path the root of a value document is named by.
text
A string.
union_cases
A union’s case members, in case order.
union_members
A union’s members, by name, in case order.
union_selection
The case a discriminator value selects, under zerodds_ast_layout::UnionLabelMatch.