Skip to main content

Module construct

Module construct 

Source
Expand description

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.

Every other grammar in this tree describes a type’s SHAPE: what columns it has, how each is stored, what a client may ask about one. This one describes a type’s CONSTRUCTOR — the sequence of calls that turns a row’s worth of values back into the value they came out of — and it exists because the rewrite mode made that sequence somebody else’s business. A declaration wrapping mediaframe::Dimensions cannot change how Dimensions is built; it can only say how it is.

§We are the DESCRIBING side, and the vocabulary is chosen from that seat

bon and its neighbours are the GENERATING side: their words dress a builder that does not exist yet — the setter’s prefix, the doc comment on the state type, the #[must_use]. None of those reaches this vocabulary, because there is no artifact here for them to decorate. What DOES reach it is every word that names a call the emission has to write:

wordseatwhat it names
builder(entry = "…")containerthe first call — new unless something else
builder(finish = "…")containerthe LAST call; writing one is what makes this a builder
builder(fallible)containerthe terminal step hands back a Result
builder(on(Type, into))containerevery field of Type reaches a seat taking impl Into
builder(call(with = "…", value = "…"))containera link no column feeds
builder(arg)fielda positional argument to the ENTRY
builder(finish_arg)fielda positional argument to the FINISH
builder(with[ = "…"])fielda chaining link, with_<field> unless renamed
builder(set[ = "…"])fieldan in-place setter, set_<field> unless renamed
builder(into)fieldthis seat takes impl Into, so the argument is PINNED
builder(map = "…")fieldthe value crosses through a function instead of Into
builder(option)fieldthe seat takes the Option whole, crossing INSIDE it
builder(skip)fieldthis column is not fed back at all

§The DEFAULT LAW is unchanged, and that is the load-bearing promise

A declaration writing none of these words builds exactly what it built before the vocabulary existed: Remote::new(<every required column, in declaration order>) followed by one .with_<name>(…) per #[ingraph(optional)] column. That is not a coincidence to be maintained by care — it is Construction::default and Build::default resolving to the same two seats the hand-written emission chose, and ingraph-codegen’s own golden asserts the token stream is the one it always was.

§A WRONG word is settled by the compiler, at the call this writes

Nothing here resolves a method: finish = "buidl" is a name, and a name that no method answers to is E0599 at the raise. That is deliberate and it is the same posture the rewrite mode already takes — the manifest is a CLAIM ABOUT AN API this crate cannot see, and the compiler is the only reader that can check one. What this module owns is the claim’s SHAPE: that a finish_arg has a finish to be an argument of, that one field fills one seat, that a word only a wrapper can spend is not written on a declaration that is its own storage.

§Where the pieces live

The grammar, the parse and the shape refusals are ingraph_derive’s construct module — exactly one copy, whichever saddle mounts it. This half is the MODEL those produce and the WRITER that spends it, and it is here rather than there because emission lives here and the dependency runs ingraph-derive → ingraph-codegen. crate::remote is the first saddle: it gathers one crossed value per manifest column and hands them to Construction::call.

Structs§

Blanket
One on(Type, into) rule — a crossing stated once for every field of a type.
Build
What ONE field says about its own place in the protocol.
Construction
What a declaration says about the way its wrapped type is BUILT.
Injection
One call(with = "…", value = "…") — a link whose value comes from the declaration itself.
Supplied
ONE value the protocol carries, already crossed, with the seat it fills and its gate.

Enums§

Cross
HOW a field’s value reaches its seat.
Filled
A Seat with every name resolved — what the writer actually spells.
Seat
WHICH call a field’s value reaches, and under what name.