pub struct FieldsModel {
pub fragment: Ident,
pub vis: Visibility,
pub krate: Path,
pub remote: Option<Path>,
pub fields: Vec<FragmentField>,
pub construction: Construction,
pub delegates: Vec<Delegate>,
pub record: Option<RecordHost>,
pub entity: bool,
pub wire: Option<WireFace>,
pub cursor: Option<Vec<Ident>>,
pub filter: Option<Path>,
}Expand description
A validated fragment: what it is called, how visible it is, and the fields every holder inherits.
PLAIN, for RecordModel’s reason — public fields, no constructor,
nothing that parses — so the derive today and a manifest front end later build the same one.
Fields§
§fragment: IdentThe fragment’s own name — the declaration this model came from.
vis: VisibilityHow visible the fragment is, and therefore how visible each emitted method is.
Mirrored rather than fixed at pub, exactly as a record’s: no one can widen a type they did
not declare.
krate: PathThe path to the ingraph crate itself — ::ingraph unless #[ingraph(crate = "…")] named
another.
Spent on the PROJECTION traits and on nothing else, which is the whole of what this expansion
reaches for: a Vec<_> field is handed back as a slice through project::Repeated and an
Option<_> through project::Optional. A fragment that declares neither shape still carries
the path, because which shapes it has is not a fact the parser makes the root depend on.
remote: Option<Path>remote = "path::To::Type" — the FOREIGN TYPE this fragment is a transparent wrapper over, or
None for the ordinary fragment that IS its fields.
The FOURTH declaration to take the word, and the first with NO IDENTITY SEAT. Its presence
changes what the fields below MEAN — they stop being the fragment’s own storage and become a
MANIFEST, the shape of the wrapped type as this framework needs to read it — while the item
the compiler sees is #[repr(transparent)] struct X(Remote);. What does NOT change is any
face: the width, the filter, the comparison and the wire object all read the manifest’s
declared types, and a declared type is a declared type whether the value behind it is held or
wrapped. What moves is the READ, which becomes the remote’s own accessor crossed by Into —
see crate::remote, whose core this tier shares with entity and record.
A syn::Path rather than a syn::Type, for
RecordModel::remote’s reason: a wrapper’s inner type is
a named type and nothing else, and the path is EMITTED, so one naming nothing is E0412 at
the string the author wrote.
fields: Vec<FragmentField>EVERY field the fragment declares, in declared order.
construction: ConstructionWhat the declaration said about the way its wrapped type is BUILT — the entry, the finish, the blankets and the injections.
Construction::default where nothing was written, which is the value that makes the words
free: a declaration writing no builder(…) gets the same call the emission wrote before the
vocabulary existed.
delegates: Vec<Delegate>delegate(fn …) — the METHODS reachable on Self this fragment restates, and whichever of
them it also publishes.
§The one door into the emitted object beyond the columns
A fragment’s wire face is an #[Object] block this emission writes, one field per declared
column, and a declaration cannot append to it: a second #[Object] impl Dimensions is two
impls of one trait for one type, which is a coherence impossibility rather than a policy. So a
value with a question its columns do not answer — an aspect ratio, an orientation — has no way
onto its own face without a seat inside the declaration, and this is that seat.
§ORIGIN is not the word’s question
An entry names a method reachable on Self and does not ask where it came from — an inherent
impl the author wrote, one the value is reached through by Deref, a trait method in scope.
Both bodies below are method-resolution syntax, so rustc answers, and a name nothing on Self
answers to is E0599 at the generated call: this family’s honesty pattern rather than a rule a
macro could have checked.
§The MODE forks the EMISSION, and only the emission
| what a plain entry emits | |
|---|---|
a REWRITE (remote named) | the FORWARDING method — see delegate, body (&self.0).m(…) — because the wrapped value’s method is otherwise reachable only through Deref, and an inherent one is what a caller and a doc page see |
| an ORDINARY fragment | nothing. The method is already the author’s own on Self, and a same-named one emitted beside it would be that method calling itself |
So on an ordinary fragment an entry’s whole content is the LIFTED half — see
lifted, body Self::m(self) — and one that publishes nothing there has no
reader at all, which the front end refuses by name. What it does NOT refuse is the origin.
The LIFTED half is a field of the object in both modes, so it arrives with
wire.
Empty is the ordinary declaration and costs nothing.
record: Option<RecordHost>record / record(<db>, …) — the RECORD-HOST activation, or None where the declaration
did not write one.
§Activation is REQUIRED, and it is what decides which faces are emitted at all
A fragment is HELD, so what it has to ANSWER is whatever the holding kind asks — and the two
kinds ask different things. A record asks for a width, a bind, a read and a comparison; an
entity holds no rows and asks for none of them. A tier that emitted both sets for every
declaration was answering questions no holder had asked, and the storage answers are the
expensive half: they are what put sqlx in the obligations of a fragment nobody stores.
So the declaration says which kinds may consume it, and a declaration that says NEITHER is a
named refusal rather than a silent nothing — see ingraph_derive::fields. There is no shorthand
for both: the words are one each, which is the vocabulary-admission bar rather than terseness.
This one gates the STORAGE faces: columns and its fence, the segment
names, carrier, assemble,
keyset and the whole of comparison.
entity: boolentity — the ENTITY-HOST activation, written bare.
BARE and nothing else, which is a door rather than a hole: entity-hosting has nothing to
configure yet, so the word activates the read faces and a configuration is a ruling away. The
tenants are known by name — an election’s projection, a fulltext or vector label on an
entity-hosted field, the keys-tier exposure — and each enters through the admission bar with
the consumer that spends it. entity(…) with anything inside is a named refusal saying so.
It gates the FULL predicate — <Fragment>Filter, one slot per DECLARED field — and the marker
rows a holder resolves a slot through. A record activates a predicate too, and it is a
DIFFERENT one: <Fragment>ColumnFilter, one slot per stored column. Each face tells its own
truth, the 2026-08-22 ruling — a record(skip)ped field’s value at a record is a raise’s
fill, and filtering a constant is a lying schema, where a rowless host holds the value itself
and every field it declares is askable.
A declaration writing ONE of the two words emits one type and seats it at both marker rows, which is what makes the common case free. One writing both emits both — two consumer worlds, two vocabularies.
wire: Option<WireFace>graphql / graphql(…) — the WIRE activation, or None where the declaration wrote none.
It gates wire whole — the crossing and the #[Object] block — and the FILTER’s
own input-object registration, which is the face that makes a holder able to publish a slot of
this predicate’s type. The Rust filter struct is not gated by it: a storage-only fragment is
still filtered, and what it lacks is a client that can name the filter.
cursor: Option<Vec<Ident>>cursor / cursor(a, b) — the KEY this fragment is a paging position by, or None where
the declaration wrote no such word.
§It is an ASSERTION, which is why it is opt-in and why it is a list
A cursor is a position in a TOTAL ORDER, and a group of fields has no order of its own: nothing
about {width, height} says which of two dimensions comes first, and a framework that picked
one would be minting an answer the declaration never gave. The word is the author saying the
order I declared these in is the one legitimate total order over this value — and the list
form is the same assertion over a NAMED SUBSET, in the order it names, for the fragment whose
declaration order is the readable one and whose key order is not.
Empty means the BARE word: every declared field, in declared order.
filter: Option<Path>filter = "path::To::Type" — the predicate a holder carries at a field that holds this
fragment, where the declaration MOUNTS one of its own, or None for the generated one.
§It is a SWAP and not an override, which is why nothing is emitted beside it
The generated filter is one slot per participating field, each guarded by whatever that field’s
type is guarded by — a total, mechanical reading of the declaration. A composite whose
vocabulary is its own says something the field list cannot: Dimensions takes aspectRatio and
orientation beside its two columns, and those are questions about the VALUE rather than about
a column. So the word does not refine the generated filter, it replaces it: the generated one is
not emitted at all — neither the struct, nor its builders, nor the input face
filter_face would have registered — and CompositeFilterMarker names
the author’s type instead.
§It takes BOTH seats, and that is the swap being a swap
The dual-face ruling gives a fragment up to two predicates, and a mounted one replaces the
pair. The stored seat it takes by necessity — the author’s filter carries the author’s
lowering, and a lowering is what the stored face IS — but it takes the full seat too, because
the alternative is a schema in which one value has two vocabularies from a declaration that
named one: the author’s predicate reachable from a record and a generated one from an entity,
with no word anywhere saying which is meant. Dimensions taking aspectRatio is a question
about the VALUE, which is the rowless face’s own subject — so the generated full face is the
LAST thing an author who wrote this word wants beside it.
What comes with the author’s filter is the author’s LOWERING. The generated filter’s own
ToDatabaseComparison<Fragment, Db> row is what says this predicate compares this value, and
it is a fact about the predicate rather than about the fragment — so a swapped filter states its
own, naming whatever comparison it lowers into, and states the value-level crossing beside it.
This emission’s comparison is still there to be named: the two layers coexist, and pointing the
author’s row at <Fragment>Comparison<Db> is what buys the hand-written face the mechanical
lowering for free. The EMPTY predicate is not part of that trade — Default is a fact about the
COMPARISON, which is this emission’s in both cases — so pair still writes it.
§It is orthogonal to the ACTIVATIONS, and rides them
The word says WHICH predicate, and the host-kind activation says whether a predicate is emitted
at all: a fragment no kind can hold has no filter for this to swap, and one that writes
graphql publishes the author’s input object rather than a generated one. So a mounted filter
is read wherever filter is read and nowhere else.
marker = … is NOT this word and is not overloaded into it. A marker answers what READING is
this column under — scalar, string, composite — and every reading a composite has resolves
through CompositeMarker to whatever this row names. The two questions are one step apart
and a word answering both would be a word answering neither.
A syn::Path for remote’s reason: it refers to a type this declaration did
not mint, and the path is EMITTED, so one naming nothing is E0412 at the string the author
wrote.
Implementations§
Source§impl FieldsModel
impl FieldsModel
Sourcepub fn emit(&self) -> TokenStream
pub fn emit(&self) -> TokenStream
The fragment’s own API: one accessor family per field, and no framework face beside it.
EVERY field takes the mutators too, and the difference from a record is a consequence rather than a choice: a record withholds them from the fields that bear identity, and a fragment has no identity-bearing field to withhold them from.
It sits inside the anonymous const every other emission here uses, which changes nothing
about reaching it: an inherent method is found through its type. Uniform rather than argued
per emission — a reader who knows where a record’s impls live knows where these do.
§A REWRITE moves this family and nothing else
With remote named, the accessor family above is replaced by
readers and the wrapper’s own two blocks join the const — the BRIDGE
prelude and the reference family, both crate::remote’s and neither this tier’s own copy.
The four FACES are untouched: columns, filter,
comparison and wire all read the manifest’s declared
types, and a declared type does not move when the value behind it starts being wrapped.
Sourcepub fn emitted_methods(&self) -> Vec<Emitted>
pub fn emitted_methods(&self) -> Vec<Emitted>
Every method this emission declares, for the front end that has to refuse a collision before an expansion lands two of one name in a scope its author cannot edit.
The walk a record’s own drives, over ONE owner instead of seven: a fragment declares one impl,
on itself. The hazard is identical — a field called x beside a copy field called x gives
the type two set_x — and so is the answer.
A REWRITE forks here exactly where readers forks and on the same predicate,
which is what keeps the enumeration a statement about the emission rather than a second
reading of the rule: one name per manifest field, the field’s own, because a wrapper declares
one reader and no member beside it.
Sourcepub fn wire_words(&self, kind: GraphqlKind) -> Vec<(String, Ident)>
pub fn wire_words(&self, kind: GraphqlKind) -> Vec<(String, Ident)>
Every word this fragment’s OBJECT publishes at one backend, paired with the token that chose it — the columns first, in declared order, then the lifted delegates.
The ONE authority on those words, for Delegate::word’s own reason: a front end refusing a
collision has to spell exactly what the emitter publishes, and a second spelling on that side
is how a refusal and an emission come to disagree about a name nobody moved. A column’s word is
its graphql(rename = "…") or the camelCase fallback beneath it — read through
wire_field, the same function the #[Object] block spells each field
with, so a renamed column is compared at the name it really publishes. A delegate’s is its own
rename or that same fallback over the restated method name.