Skip to main content

Module default_rust

Module default_rust 

Source
Expand description

The value a generated Rust member takes when the stream does not carry it.

Table 9 of DDS-XTypes 1.3, as a Rust expression. The reflective column’s copy of the same table is zerodds_wire_codec::default (re-exported by crates/wire-probe/src/default.rs), which carries the clause quotations and the reasoning for the kinds Table 9 does not list. Deliberately a third derivation and not a call into the first: the columns are compared against each other, and a shared helper would make them agree about a mistake.

§Why an expression and not Default::default()

The types this column materialises derive nothing — crate::adapter::cst sets derives: Vec::new() on every struct and enum it emits, because a derive is a decision about the target language and not about the wire. So the default is written out: a struct literal with a value per member, an enum’s first variant, an empty Vec. Default would also be the language’s zero and not Table 9’s, and the two part company at an enumeration whose first literal has a @value other than zero.

Functions§

default_of
Table 9’s default for a type.
member_default
One member’s default: its @default, or its type’s.