Skip to main content

ComposeOptions

Struct ComposeOptions 

Source
pub struct ComposeOptions {
    pub default_extensibility: Option<Extensibility>,
    pub default_nested: Option<bool>,
    pub defines: Vec<(String, String)>,
    pub hashed_id_advances_the_counter: HashedIdCounter,
    pub hashed_name_spelling: HashedNameSpelling,
    pub key_on_union_discriminator: KeyOnUnionDiscriminator,
    pub name_of_the_enclosing_scope: NameOfTheEnclosingScope,
    pub dialect: Dialect,
}
Expand description

What the caller decides that the source does not.

Fields§

§default_extensibility: Option<Extensibility>

What an aggregate of unspecified extensibility is taken to be.

None leaves the facet absent, so “the source said appendable” stays distinguishable from “the source said nothing” and Ast::effective_extensibility applies XTypes 1.3 §7.3.1.2.1.8’s default. Some writes it into the model, which is what that same paragraph provides for:

Implementations may provide a mechanism to override this default behavior; for example, IDL compilers may provide configuration options to allow users to specify whether types of unspecified extensibility are to be considered final, appendable, or mutable.

What the source did say still wins. This fills silence only, which is why it is an option here and not a rewrite of the tree.

§default_nested: Option<bool>

The @default_nested of the top-level modules that carry none of their own — the compiler option DDS-XTypes 1.3 §7.3.1.2.1.7 requires (“IDL compilers shall provide the means to change the default value for non-annotated top-level modules”). None is the specification’s FALSE. See zerodds_idl_lower::Options::default_nested.

§defines: Vec<(String, String)>

Macros defined before the first line is read — a build system’s -D. An empty body is -DNAME: defined, expanding to nothing.

§hashed_id_advances_the_counter: HashedIdCounter

Whether a @hashid member advances the sequential id counter.

A dialect axis and not a preference: vendors disagree, and the answer changes the id of every member after a @hashid one. It is here because the wire corpus varies it, and the corpus and a build have to be able to load a file the same way — two load paths with the same intent is how a production path came to skip the resolve pass entirely.

§hashed_name_spelling: HashedNameSpelling

Which spelling of an escaped name a member-id hash reads. The same kind of axis as the counter above — RTI hashes _long as written where the clause hashes long — and here for the same reason: the corpus and a build have to load a file the same way.

§key_on_union_discriminator: KeyOnUnionDiscriminator

Whether @key on a union discriminator is carried.

The same axis zerodds-xml-compose carries, and here for the reason the two above are here: a type declared once in IDL and once in XML has to reach the same model, and the key bit is part of its TypeIdentifier.

§name_of_the_enclosing_scope: NameOfTheEnclosingScope

Whether a declaration may carry the name of the scope it sits in.

The same kind of axis as the three above, and here for the same reason: the corpus and a build have to load a file the same way. The measurement behind it is the corpus case resolve-module-named-as-type, which Cyclone DDS and OpenDDS refuse and Fast DDS and RTI Connext take.

§dialect: Dialect

Which vendors’ extensions this composition admits. Spec §3.5.

Reaches two stages, because vendor constructs live in two: the parser sees keylist as grammar, the lowering sees #pragma keylist and OpenDDS’s DCPS_* as directives that change the model. Dialect::STRICT turns both from a warning into an error.

Not part of a derived Default: see the impl Default below.

Implementations§

Source§

impl ComposeOptions

Source

pub fn lowering(&self) -> Options

The lowering options these map to.

Trait Implementations§

Source§

impl Clone for ComposeOptions

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 Debug for ComposeOptions

Source§

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

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

impl Default for ComposeOptions

ComposeOptions::default() admits every vendor extension.

Written out rather than derived, because Dialect::default() is STRICT and the two defaults are deliberately opposite. A tool pointed at a file somebody else wrote should read it before it judges it; --strict is the caller who asked the other question.

Source§

fn default() -> Self

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

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.