ingraph-codegen 0.1.0

The emission engine behind ingraph-derive: a plain declaration model in, the ingraph framework faces out.
Documentation
#![deny(missing_docs)]
// The docs.rs badge half: `doc_cfg` derives the "Available on crate feature `x` only" banner from
// the `cfg` a gated item already carries. This crate declares NO features, so it derives nothing
// today — the attribute is here because the knob that turns it on is, and the two belong together:
// `docsrs` is set by the `rustdoc-args` in `[package.metadata.docs.rs]` below and by nothing else,
// so a root that never named `doc_cfg` would leave that cfg dangling. Nightly-only, hence the
// `cfg_attr`; every stable build compiles a crate that has never heard of `docsrs`.
#![cfg_attr(docsrs, feature(doc_cfg))]
//! The emission engine behind [`ingraph-derive`](https://docs.rs/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.

pub mod aggregate;
pub mod alias;
pub mod catalog;
/// The COMPOSED MODE's model — the wire face of a filter struct somebody wrote by hand, built out
/// of its own fields.
pub mod composed;
/// THE CONSTRUCTION PROTOCOL's model — the sequence of calls a wrapped type is built by, and the
/// writer that spells one.
pub mod construct;
pub mod cron;
pub mod delegate;
pub mod duration;
/// The ELEMENT MODE's model — a declared element's own filter, and the citizenship it needs.
pub mod element;
pub mod emit;
/// WHERE an elected field is written — the engine blocks, and the `(field × engine)` slots they are.
pub mod engine;
pub mod enumeration;
/// The LEAF ERROR's model — an application's own failure type, dressed to render under its code.
pub mod error;
pub mod extension;
/// The FIELD-FRAGMENT TIER's model — the fields a holder inherits, and the width they occupy.
pub mod fields;
pub mod flags;
/// THE FUSION TREE's own emission — the leaf and tier packages a declaration mints, and the
/// `Fusable` impl a parent absorbs them through.
pub mod fuse;
pub mod graph;
/// 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.
pub mod id;
pub mod index;
pub mod interface;
pub mod journal;
pub mod launch;
pub mod method;
pub mod model;
/// 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.
pub mod mutation;
pub mod name;
/// THE NEWTYPE DEVICE's model — the kits a declared wrapper opts into, and the pass-through row
/// each one installs.
pub mod newtype;
pub mod options;
pub mod plural;
/// 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.
pub mod prefix;
pub mod remote;
pub mod resource;
/// THE SEARCH RECIPE's model — the members a recipe fuses, the towers bound to them, and the seats
/// one broadcast question is filled at.
pub mod search;
/// 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.
pub mod source;
/// The STANDALONE family's model — a hand-written struct's three faces, composed from the units.
pub mod standalone;
/// THE TOWER's model — a question pipeline's two ends, its steps, and the chain the emission
/// demands between them.
pub mod tower;
pub mod union;
/// The FACTORED UNITS the grammar words compose and the standalone derives are the bare doors of.
pub mod unit;

/// Everything a front end needs, in one `use`.
pub mod prelude {
  pub use crate::{
    alias::{ALIAS_PREFIX, DEPTH_CEILING},
    construct::{Blanket, Build, Construction, Cross, Injection, Seat},
    delegate::{Delegate, DelegateSkin},
    emit::PAIRED,
    engine::{Engine, EngineKind, FieldEngines, Slot},
    // `index::Upstream` is NOT among these, and the one-word rename is why. `source` → `upstream`
    // gave both grammars the same word, so this crate now holds two `Upstream` structs: the
    // record's (`model::Upstream`, one `upstream(…)` entry inside `subscribe(…)`) and the index
    // family's (`index::Upstream`, the `upstream(node = …, <field> = …)` block). A prelude can
    // carry one of them unqualified. It carries the record's, which every front-end path names;
    // the index one has a single consumer and that consumer already spells `index::Upstream`.
    index::{IndexModel, Projected},
    journal::JournalModel,
    method::{ColumnOrigin, Emitted, Member, Origin, Owner},
    model::{
      AliasOptions, Artifact, ArtifactBytes, AsyncGraphql, BackendError, ChangesFeed,
      ChannelOptions, Column, CompositeUnique, Condition, Conversion, Crossing, DatabaseBackend,
      DatabaseKind, Declared, Derived, Face, FallibleConversion, FanIn, Field, Fill, Filled,
      FrameworkMarker, Fusion, Grant, Grants, Graphql, GraphqlBackend, GraphqlField, GraphqlKind,
      Key, Kind, Label, Lineage, Marker, Mirror, MongoDatabase, MySqlDatabase, NodeKind, Persist,
      PersistColumn, PollBody, PollCadence, PollEntry, PollMode, Polls, PostgresDatabase,
      PostgresProgress, Product, Products, Progress, ProgressHost, Projection, RecordModel,
      Reference, Role, Shape, SqliteDatabase, SqliteProgress, Storage, Subscription, Through,
      TracingLevel, Upstream, Upstreams, WireLeg, WirePosition, borrowed_key,
      default_channels_name, default_comparison_name, default_downstream_name, default_due_name,
      default_filter_name, default_in_name, default_input_name, default_key_name,
      default_key_output_name, default_lineage_name, default_order_by_name, default_out_kind_name,
      default_out_name, default_output_name, default_polling_name, default_row_name,
      default_sweeps_name, fanned_lineage, fanned_lineage_column, one_storage_marker,
      poll_grants_name, shelf_name,
    },
    name::RustSafeName,
    prefix::EmissionPrefix,
  };
}

#[cfg(test)]
mod tests;