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:
| step | where it is now |
|---|---|
#include / #define expansion | zerodds_idl_parse::preprocess |
| parse | zerodds_idl_parse::parse_preprocessed |
vendor key pragmas → @key | zerodds-idl-lower’s apply_keylists |
| default extensibility | Ast::effective_extensibility |
| type objects | zerodds_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§
- Compose
Options - What the caller decides that the source does not.
- Composed
- What one composition produced.
- Path
Loader - A loader over the filesystem, with a search list for
#include.
Enums§
- Hashed
IdCounter - Re-exported because
ComposeOptionscarries it in a public field: a caller that cannot name the type cannot construct the options, andzerodds-buildcould not until this was here. Whether a@hashidmember advances the sequential counter. - Hashed
Name Spelling - Which spelling of an escaped name a member-id hash reads.
- KeyOn
Union Discriminator - Whether
@keyon a union discriminator is carried into the model. - Name
OfThe Enclosing Scope - 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.