Skip to main content

MutationNode

Trait MutationNode 

Source
pub trait MutationNode {
    type Command: 'static;
}
Available on crate feature runtime only.
Expand description

THE COMMAND FACE of a source: the node whose fields are the vocabulary an app can say to it.

A thin seat, and deliberately: what a mutation node IS — its fields (each of them one Mutation), their handlers, the errors each declares — is the mutation declaration’s business, and what the SOURCE layer needs of it is one thing only, which is the type a Control line carries.

§The two nothings, and why () sits here

spellingwhat it iswhere it belongs
()the SEAT-LEVEL nothing — this source has no command face at allSource::Mutation
Noopthe WIRE-LEVEL nothing — a published position whose honest content is nonea schema row that must render as something

They are not two spellings of one fact. () is ABSENCE at compile time: the seat is filled by the type that carries no information, nothing is emitted for it, and the control arm of run is provably dead. Noop is a type a schema HOLDS — it exists because an emitted row has to render, and its own note says so. Putting Noop in this seat would make one word mean both, and a source that mounts nothing would publish a command face saying nothing.

§The arm nothing can reach

()’s command type is Infallible, which has no values. So a Control<Infallible> can never hand one out, and the arm a run body writes for it is exhaustive with NO arms — the compiler’s own proof that an uncontrollable source’s control seat costs it nothing:

use ingraph::MutationNode;

/// What a `run` body would do with a command from an ABSENT mutation seat.
fn eat(command: <() as MutationNode>::Command) -> ! {
  // There is no value of this type, so there is no arm to write. This IS the body.
  match command {}
}

§It is IMPLEMENTED by the mutation declaration

#[ingraph::mutation] emits the row for the node it is written on — type Command being the enum that declaration mints, one variant per field. The impl for () below is the framework’s own and the only one this crate writes.

Required Associated Types§

Source

type Command: 'static

What an app says to a source wearing this face — the enum the node’s own declaration mints, one variant per field.

'static, which is Control’s own requirement stated where an author meets it: a command is minted by a handler and applied inside a loop that was already running when it was minted, so it cannot borrow from either. Stating it HERE is what makes a command type that could not travel an error on the declaration rather than one deep inside a run signature.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl MutationNode for ()

THE ABSENT SEAT: a source with no command face at all.

Infallible and not a unit of this crate’s own, because the claim being made is exactly the one an uninhabited type makes: there is no command, so there is no value, so the arm is dead by construction rather than by convention. See the trait’s own note for the law and for why Noop is not this.

Implementors§