Skip to main content

Crate ingraph_codegen

Crate ingraph_codegen 

Source
Expand description

The emission engine behind ingraph-derive.

Model in, tokens out. Nothing here parses: model::RecordModel is a plain struct with public fields, so the two front ends that will ever build one — the derive today, ingraph-compiler from a manifest later — reach the SAME emitter without either of them being this crate’s concern. Validation belongs with those front ends, which hold the source spans to report at.

The manifest is not this crate’s, despite what an earlier draft of this doc said: under the settled architecture a manifest and a GraphQL schema are compiled by ingraph-compiler into the decorated declarations these macros expand. This crate is the last step of that pipeline, and the whole of it for a hand-written record.

§WHAT THE TOKENS ASSUME ABOUT ingraph’s TIERS

ingraph is cut into tiers — a vocabulary core, then engine, then runtime, then derive — and this crate emits __private::drive, __private::source, __private::operator, __private::resource and __private::retrieve freely, because the tiers behind those shelf segments are IMPLIED by the feature that supplies the words a declaration is written in. The emitter therefore writes no tier gate at all, and there is no if_runtime! to write one with.

That is a fact about the framework’s feature table rather than a promise this crate makes, and it is what keeps the emitter free of a decision it could not express anyway: a #[cfg] written into emitted tokens is evaluated in the DECLARING crate, so it asks a question about somebody else’s manifest. The gate family in ingraph::gate exists for exactly the conditions that cannot be settled here; the tiers are not among them, because they are settled by implication before an expansion is ever reached.

Modules§

aggregate
The AGGREGATE declaration’s model — the three parts every aggregation has, read off a grammar and held until the emission arrives.
alias
The SQL table aliases a record’s rows are addressed by inside a nested statement, minted HERE rather than at the moment one is rendered.
catalog
THE ROOT CATALOG’s resource half: the fields a graph root marks #[ingraph(resource)], what a deployment configures them through, and the walk that declares them.
composed
The COMPOSED MODE’s model — the wire face of a filter struct somebody wrote by hand, built out of its own fields. THE COMPOSED MODE’s model: what #[derive(ingraph::Filter)] emits when the declaration wears #[ingraph(composed)] — the wire face of a filter struct somebody wrote by hand, built out of the fields themselves.
construct
THE CONSTRUCTION PROTOCOL’s model — the sequence of calls a wrapped type is built by, and the writer that spells one. THE CONSTRUCTION PROTOCOL — what it takes to build somebody else’s value, described.
cron
THE CRON SEAM, expansion side: is this a calendar expression, and is that a zone?
delegate
The DELEGATE SEAT’s model — one restated signature, how it takes its receiver, and whether it is also PUBLISHED.
duration
The duration grammar at EXPANSION time — every = "10m" read into the value the emission spells.
element
The ELEMENT MODE’s model — a declared element’s own filter, and the citizenship it needs. The ELEMENT MODE’s model: what #[derive(ingraph::Filter)] emits when the declaration wears #[ingraph(operator(<family>))] — a filter type the DECLARING crate owns, plus the citizenship its element needs to be an operand at all.
emit
Model in, tokens out.
engine
WHERE an elected field is written — the engine blocks, and the (field × engine) slots they are. WHERE an elected field is written: the engine blocks a declaration wears, and the SLOT each one names.
enumeration
The VOCABULARY face: what a unit-variant enum expands into.
error
The LEAF ERROR’s model — an application’s own failure type, dressed to render under its code. THE LEAF ERROR’s midwife: an application’s own failure type, dressed to render.
extension
HOW an artifact family’s addresses END — the extension word’s six forms, as a model.
fields
The FIELD-FRAGMENT TIER’s model — the fields a holder inherits, and the width they occupy. The FIELD-FRAGMENT TIER’s emission — the faces a value has, and none of the faces a NODE has.
flags
The FLAGS face: what a #[ingraph::flags(u32)] declaration expands into.
fuse
THE FUSION TREE’s own emission — the leaf and tier packages a declaration mints, and the Fusable impl a parent absorbs them through. THE FUSION TREE, as a declaration mints it: the leaf packages a slot is configured and asked with, the tier packages that fuse them, and the one [Fusable] impl that hands the whole subtree to a parent by projection.
graph
The GRAPH ROOT: what a struct whose fields are an application’s nodes expands into.
id
THE ID DEVICE’s model — the register a #[repr(transparent)] id wrapper is equipped with, from the sealed vocabulary’s transparency row out to the schema’s own scalar. The ID DEVICE’s model: what #[derive(ingraph::Id)] emits for a #[repr(transparent)] tuple wrapper — the whole register a product’s own id type used to hand-write, from one word.
index
A DERIVED INDEX’s emission — the expansion that carries an identity it did not mint.
interface
The INTERFACE face: a member set with a CONTRACT over it.
journal
The JOURNAL declaration’s emission: the canonical record, and the row contract over it.
launch
THE LAUNCH ENTRY: the one door a deployment of a graph root goes through.
method
Every method an emission declares, and the ONE place a derived name is shaped.
model
What a record means, once every rule has been checked — the shape crate::emit turns into tokens.
mutation
THE MUTATION NODE’s model — the command vocabulary a source is controlled through, and the record a source’s own expansion reads that declaration through. The MUTATION NODE’s model and its DECLARATION-SIDE emission: the command vocabulary a source is controlled through, and the record a source’s own expansion reads that declaration through.
name
A name with two faces: the one a database sees and the one Rust can spell.
newtype
THE NEWTYPE DEVICE’s model — the kits a declared wrapper opts into, and the pass-through row each one installs. The NEWTYPE DEVICE’s model: what #[derive(ingraph::NewType)] emits for a single-field struct this crate declares — one citizenship row per KIT the declaration opted into, every one of them a pass-through to the type inside.
options
The OPTIONS SPINE: what a graph root’s own name becomes when a deployment configures it.
plural
The ENGLISH PLURAL at expansion time — the word a list face is named from when a declaration wrote none.
prefix
THE EMISSION PREFIX — the mark every name this crate mints into a declaration’s own scope wears, and the seat a domain framework building these models sets to its own. The EMISSION NAMESPACE: the mark every name this crate mints into somebody else’s scope wears, held as ONE value a front end sets rather than as a constant each mint re-spells.
prelude
Everything a front end needs, in one use.
remote
The REWRITE MODE’s emission — what a declaration means when it WRAPS a foreign type.
resource
The RESOURCE declaration’s emission: citizenship, the mode the declaration recorded, and — where a BUILTIN KIND WORD was written — the engine the macro mints and the impls that delegate to it.
search
THE SEARCH RECIPE’s model — the members a recipe fuses, the towers bound to them, and the seats one broadcast question is filled at. What a SEARCH RECIPE declared: the members it fuses, the towers it binds to them, and the seats a caller broadcasts one question into.
source
THE ORIGIN’s model — the double entry a source declaration writes between its mutation word and the type Mutation seat its author’s own impl fills. The SOURCE declaration’s emission: the DOUBLE ENTRY, which is the whole of what a source declaration writes.
standalone
The STANDALONE family’s model — a hand-written struct’s three faces, composed from the units. The STANDALONE family’s model: a hand-written struct’s Filter, Comparison and OrderBy faces, composed from the same unit walks #[ingraph::record(…)] composes.
tower
THE TOWER’s model — a question pipeline’s two ends, its steps, and the chain the emission demands between them. The TOWER declaration’s emission: the CONNECTIVITY, which is what makes a question pipeline a compile-time theorem, and the WALK that spends it.
union
The UNION face: what an enum whose variants CARRY their members expands into.
unit
The FACTORED UNITS the grammar words compose and the standalone derives are the bare doors of. The FACTORED UNITS: the per-column emissions a grammar word composes, and the same emissions a standalone derive is the bare door of.