ingraph 0.1.0

A declaration-driven indexing framework: records and nodes are written as Rust types, and the storage rows, the dataflow between them and the GraphQL query surface are emitted from the declaration.
Documentation
//! [`Fusable`] — the capability a RETRIEVING member answers a fused query through, and the one seam
//! the fusion tree is assembled over.

/// WHAT a member contributes to a fused query: the options package it is configured with, and the
/// question package it is asked with.
///
/// # It is a PROJECTION SEAM and never a registry
///
/// A tier that fuses several routes has to name each route's configuration TYPE, and those types are
/// written in declarations it cannot see — a graph root holds a member's type PATH and nothing else,
/// and an index's own expansion is tokens no other derive will ever read. So the parent names
/// nothing: it PROJECTS, `<Member as Fusable>::Options`, and the compiler resolves the meeting. That
/// is [`Graphql`](crate::transform::Graphql)'s mechanism one family over, and it is why a third-party
/// member joins a root's package with zero edits to the root — implement this, and the projection
/// absorbs it.
///
/// A member that retrieves nothing does not implement it, and the presence law follows from that
/// rather than from a check: a record, an operator or a blob family has no fusion package because it
/// has no `Fusable` impl, so a package that named one is `E0277` at the projection rather than a
/// silently empty field.
///
/// # TWO associated types, because the tree is TWO isomorphic trees
///
/// [`Options`](Self::Options) carries the knobs — weights, floors, the per-tier fusion flavour — and
/// [`Question`](Self::Question) carries the QUESTION, each route in its own currency. They are separate
/// seats because they are filled by different parties at different times: a deployment or a client
/// configures the first, and every request supplies the second. One seat carrying both would make a
/// query that changes no knob restate every knob.
///
/// # No bounds, on either
///
/// What a member's package must BE is the member's question. A `Default` bound would have been the
/// tempting one — a parent's `const new()` could then build a child package rather than leaving it
/// absent — and it is refused for the reason the whole options tree is `Option`-shaped: absence at a
/// parent means *this route was not configured*, which is a different fact from *this route was
/// configured with its defaults*, and only the first one composes.
#[diagnostic::on_unimplemented(
  message = "`{Self}` has no fusion package",
  label = "this member answers no retrieve, so a fused query cannot route to it",
  note = "a fusion package is emitted for a `#[ingraph::fulltext(…)]` or `#[ingraph::vector(…)]` \
          declaration; records, operators, journals and artifact families are not retrieving \
          members and do not join a fused query",
  note = "a THIRD-PARTY member joins by implementing `Fusable` — the parent's package absorbs it by \
          projection, with no edit to the parent"
)]
pub trait Fusable {
  /// The KNOBS this member is configured with — its own tier package, flat where the member has one
  /// route and nested where it has several.
  ///
  /// Which shape it is, is the member's business and is invisible at every parent: the binding table
  /// picks a single-slot leaf package or a multi-route fuse package, and both arrive here as one
  /// type.
  type Options;

  /// The QUESTION this member is asked with — the sister tree's node, isomorphic to
  /// [`Options`](Self::Options) and carrying each route's question in that route's OWN currency.
  ///
  /// # It is the TREE NODE and not a modality discriminator
  ///
  /// Whether a route is asked in text or in raw coordinates is decided per LEAF SEAT — the
  /// `question` row and the `coordinates` row of an emitted package — under the resolution chain
  /// [`asked`](super::asked) states. This seat carries whichever package the member's own tier
  /// minted, and a parent absorbs it without knowing which of its rows a request will fill.
  type Question;
}

#[cfg(test)]
mod tests;