Skip to main content

Crate zerodds_idl_compose

Crate zerodds_idl_compose 

Source
Expand description

The shared IDL composition pipeline.

Crate zerodds-idl-compose. Safety classification: STANDARD. Build-time only, std, forbid(unsafe_code).

One call — compose — takes a path and produces the model plus its registered type objects. Every build-time consumer goes through it, so a build.rs and the command-line tool see the same thing from the same file.

§What this crate no longer does

It used to do five things, and it existed because only the CLI did all five: the build.rs scripts called the parser directly and got none of them. Four have since moved into the front end, where they belong:

stepwhere it is now
#include / #define expansionzerodds_idl_parse::preprocess
parsezerodds_idl_parse::parse_preprocessed
vendor key pragmas → @keyzerodds-idl-lower’s apply_keylists
default extensibilityAst::effective_extensibility
type objectszerodds_types::from_ast

The fourth is the one worth naming. It used to write an explicit @final/@appendable onto every unannotated aggregate so that each backend would agree. The model answers the question instead, in one place, and nothing is written into the tree — which is what stops two backends from disagreeing without either of them being wrong.

What is left here is the composition itself: resolving include paths against a search list, and running the four stages in order.

Structs§

ComposeOptions
What the caller decides that the source does not.
Composed
What one composition produced.
PathLoader
A loader over the filesystem, with a search list for #include.

Enums§

HashedIdCounter
Re-exported because ComposeOptions carries it in a public field: a caller that cannot name the type cannot construct the options, and zerodds-build could not until this was here. Whether a @hashid member advances the sequential counter.
HashedNameSpelling
Which spelling of an escaped name a member-id hash reads.
KeyOnUnionDiscriminator
Whether @key on a union discriminator is carried into the model.
NameOfTheEnclosingScope
Whether a declaration may reuse the name of its immediate scope.

Functions§

compose
Preprocess, parse, lower and register, from a path.
compose_all
Compose several units into one model.
compose_all_sources
As compose_all, over text the caller already has.
compose_source
As compose, over text the caller already has.
compose_source_with
As compose_source, deciding what the source leaves open.
compose_with
As compose, deciding what the source leaves open.