Skip to main content

Module source

Module source 

Source
Expand description

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.

ⓘ
#[ingraph::source(async, mutation(node = "WatchOps"))]
pub struct Watch { … }

impl AsyncSource for Watch {
  type Mutation = WatchOps;      // the TYPE half — the author's own hand
  …
}

§Two entries for one fact, and the emission is what holds them together

A source’s command face is written TWICE, and neither spelling can be dropped. The WORD is what the declaration says — it is what a manifest front end, a schema walk and a reader see — and the TYPE is what the compiler resolves a Control line through. Two macro expansions cannot read each other’s tokens and an attribute macro cannot write somebody else’s impl, so the word cannot mint the type and the type cannot mint the word.

What this emission writes is the JOIN: one bound, stated over the declared type, naming the node the word named. So the two entries are checked against each other at the declaration, in BOTH directions:

writtenwhat happens
mutation(node = "WatchOps") and type Mutation = WatchOpsit compiles
mutation(node = "WatchOps") and type Mutation = () (or another node)E0271 at the WORD
no word and type Mutation = WatchOpsE0271 at the DECLARATION
no word and type Mutation = ()it compiles

The third row is the one a single-entry design would have lost: a source that mounted a node and forgot to say so would publish no wire face and no reader would ever know, because a missing word looks exactly like a source nobody controls. The bound is what makes silence impossible.

§The FACE is the async word’s, and the word is what names the trait

#[ingraph::source] binds Source and #[ingraph::source(async)] binds AsyncSource — the dual-mode law’s word-selects-face rule, applied at the one position that has to name a trait to state anything at all. A declaration whose word and whose impl disagree is E0277 at the declaration, naming the face it does not wear, which is what Source’s own on_unimplemented note is written for.

§THE RECORD a launch walk mounts it through

Beside the entry, one impl:

ⓘ
impl DeclaredOrigin for Watch {
  type Mode = Block;                                  // the `async` word, as a TYPE
  const MOUNTS: Option<&'static str> = Some("WatchOps");
}

Declared’s own arrangement for the origin layer: a walk that mounts an origin sees a type, so the declaration STATES what it is and the walk NAMES it through a projection. The Mode seat is what makes one mount door serve both faces, and the string is for a reader rather than for the compiler — what resolves the mount is the seat the double entry is stated over.

§NOTHING ELSE is emitted

No command enum (the node’s own declaration mints it), no MutationNode row (the node’s), no resolver (the node’s binding pass). The host is echoed, one anonymous const is written beside it, and the record above.

Structs§

SourceModel
A validated source declaration, ready to emit.