pub enum KeyOnUnionDiscriminator {
Refused,
Carried,
}Expand description
Re-exported because ComposeOptions carries them in public fields,
exactly as zerodds-idl-compose re-exports them: a caller that
cannot name the type cannot construct the options.
Whether @key on a union discriminator is carried into the model.
§The clause permits it
DDS-XTypes 1.3 Table 21 lists @key against “Structure Members,
Union discriminator”, and §7.2.2.4.4.4.8’s own example is
union MyCommand switch (@key CommandKind) { /* … */ };so the default is to carry it: a front end that refuses the declaration, or tells the author the annotation “has no meaning” there, states the opposite of the specification.
§What the implementations do
Measured on the four toolchains the Linux test host carries:
union U switch (@key uint32) | |
|---|---|
Cyclone idlc | refuses the file — “Using union type as part of the key is currently unsupported” |
rtiddsgen | refuses it at the discriminator — “@key is not supported” |
fastddsgen | generates no PubSubType for a union at all, so it has no keyed topic to compare against |
opendds_idl | not recorded in that run |
So under Self::Carried this project computes a KeyHash over a
union discriminator that no measured peer computes. Self::Refused
is the setting for a tool that has to stay within what those
toolchains accept; it names the clause that permits the declaration
in its diagnostic.
§Why the OMG suite needs it
union_uint32_one_key pairs unions.xml’s union_uint32 against
unions_key_discriminator.xml’s union_uint32_key, whose
discriminator carries key="true", and expects INCONSISTENT_TOPIC
on both sides: §7.2.4.4.4.5 requires that “either the discriminators
of both T1 and T2 are keys or neither are keys”. Under
Self::Refused the subscriber never creates the topic and the case
reports TOPIC_NOT_CREATED; under Self::Carried the declaration
loads, the discriminator’s IS_KEY reaches its TypeObject, and the
two types are found not assignable — which is the verdict the suite
asks for.
A named type and not a bool for the reason HashedIdCounter is
one: Options is Default, and a boolean defaulting to false
would carry no statement about which reading that is.
Variants§
Refused
The annotation is reported and the declaration does not carry it. What the measured toolchains do.
Carried
The annotation is carried: the model records it, the
discriminator’s UnionDiscriminatorFlag gets IS_KEY, the
union is a keyed topic type and its KeyHash is computed over the
discriminator alone. The default, as Table 21 and
§7.2.2.4.4.4.8 have it.
Implementations§
Source§impl KeyOnUnionDiscriminator
impl KeyOnUnionDiscriminator
Sourcepub const ALL: [KeyOnUnionDiscriminator; 2]
pub const ALL: [KeyOnUnionDiscriminator; 2]
Both.
Sourcepub const fn is_default(self) -> bool
pub const fn is_default(self) -> bool
Whether this is the default.
Sourcepub fn parse(value: &str) -> Option<KeyOnUnionDiscriminator>
pub fn parse(value: &str) -> Option<KeyOnUnionDiscriminator>
Parse a configuration value.
An unknown value returns None rather than falling back to the
default: a typo here changes a type’s TypeIdentifier.
Trait Implementations§
Source§impl Clone for KeyOnUnionDiscriminator
impl Clone for KeyOnUnionDiscriminator
Source§fn clone(&self) -> KeyOnUnionDiscriminator
fn clone(&self) -> KeyOnUnionDiscriminator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more