Skip to main content

EnumeratorValue

Enum EnumeratorValue 

Source
pub enum EnumeratorValue {
    Declared,
    Ordinal,
}
Expand description

Which integer an enumerator serialises as.

XTypes 1.3 §7.4.3.5.3 rule (5) is XCDR << {O : ENUM_TYPE} = XCDR << { O.value : O.holder_type }, and IDL 4.2 §7.4.13 gives O.value as the @value(n) the enumerator declares, else the previous enumerator’s value plus one, starting at zero. So the clause has an answer, and it is Self::Declared.

§What is measured

Two front ends drop @value and number the enumerators by position, and 40 recorded rows differ by exactly that. enum-negative-value, enum-sparse-values, enum-bitbound-{8,16,32}-value and their unannotated twins, OpenDDS, both encoding versions and both byte orders — the same length in every row, and the first differing octet is octet 0:

enum-negative-value    @value(-1) MINUS, @value(0) ZERO, @value(2147483647) MAX
  ours    ffffffff 7fffffff
  theirs  00000000 00000002

enum-sparse-values     @value(1) OK, @value(100) WARN, @value(65535) FAIL
  ours    0000ffff 00000001 00000064
  theirs  00000002 00000000 00000001

enum-bitbound-8-value  @value(3) RED, @value(9) GREEN, @value(200) BLUE
  ours    000000c8 00000009 ab
  theirs  00000002 00000001 ab

opendds_idl answers error in lookup of symbol: bit_bound and the same for value; tao_idl drops the annotation the same way — docs/wire-feature-inventory.md row E1, and warnings.rs::CLASSIFICATION already carries the warning with carried_into: "E1". Cyclone, RTI and Fast DDS all carry @value. Two front ends dropping the annotation and three carrying it is the same shape as EnumHolderWidth, and it takes the same answer: not an axis by judgement 3, and a setting all the same, because a peer that writes the ordinal writes the ordinal whatever the reason and a reader of the declared value is reading a different enumerator.

§It is not the holder’s width, and the corpus separates them

The two questions look like one on enum-bitbound-8-value, where OpenDDS’s octets differ from this project’s in both. They are not: enum-negative-value declares no @bit_bound at all and still differs, and enum-bitbound-8-plain declares @bit_bound(8) with no @value and is closed by EnumHolderWidth alone. The 16 rows of enum-bitbound-{8,16}-value need both — the four-octet holder and the ordinal — which is why EnumHolderWidth closed 76 rows and not the 92 an estimate gave, and why those 16 were the difference between the causes named for OpenDDS and the rows measured open.

§It is not a planner setting

The holder’s width does not change, so no offset moves and no EMHEADER length code changes. It stays out of LayoutKey::offset_key for the same reason MapEntryOrder and UnionLabelMatch do.

§It is a reader setting

Unlike MapEntryOrder. All 40 rows reach a reader: a peer’s 00000002 is BLUE’s ordinal and this project’s MAX’s declared value, and a decoder that took the pattern for a declared value would name a different enumerator or none at all.

§No dialect selects the second value

For the reason EnumHolderWidth::BitBoundDroppedByFrontEnd is not selected either: OpenDDS and TAO are recorded peers here rather than presets, and a front-end defect is not a reading of §7.4.3.5.3. --enumerator-value ordinal reaches it.

Variants§

§

Declared

The value IDL 4.2 §7.4.13 gives: @value(n), else the previous enumerator’s value plus one, from zero.

The default, and what Cyclone, RTI and Fast DDS write.

§

Ordinal

The enumerator’s position in its declaration, from zero, whatever @value says.

What a front end that does not know the annotation writes. Identical to Self::Declared for an enumeration that declares no @value — which is every enumeration in the corpus but five — so the setting is invisible except where the annotation is.

Implementations§

Source§

impl EnumeratorValue

Source

pub const ALL: [Self; 2]

Both.

Source

pub const fn is_default(self) -> bool

Whether this is the default.

Source

pub const fn as_str(self) -> &'static str

Short name, for configuration and diagnostics.

Source

pub fn parse(value: &str) -> Option<Self>

Parse a configuration value.

An unknown value returns None rather than falling back to the default: a typo in a wire-affecting setting must be loud.

Trait Implementations§

Source§

impl Clone for EnumeratorValue

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for EnumeratorValue

Source§

impl Debug for EnumeratorValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EnumeratorValue

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for EnumeratorValue

Source§

impl Hash for EnumeratorValue

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for EnumeratorValue

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for EnumeratorValue

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for EnumeratorValue

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for EnumeratorValue

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.