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
use super::Fusable;

/// A member's package as an emission would mint it — flat, because this fixture has one route.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
struct TranscriptFulltextOptions;

/// Its question twin.
#[derive(Debug, Clone, PartialEq, Eq, Default)]
struct TranscriptFuseQuestion;

/// A retrieving member.
struct Transcript;

impl Fusable for Transcript {
  type Options = TranscriptFulltextOptions;
  type Question = TranscriptFuseQuestion;
}

/// **THE PROJECTION IS THE JOIN.** A parent names neither package: it writes
/// `<Member as Fusable>::Options` and the compiler resolves the meeting — which is the whole of what
/// lets a third-party member join a root with no edit to the root.
#[test]
fn a_parent_reaches_a_members_packages_by_projection_alone() {
  let options: <Transcript as Fusable>::Options = TranscriptFulltextOptions;
  let query: <Transcript as Fusable>::Question = TranscriptFuseQuestion;

  assert_eq!(options, TranscriptFulltextOptions);
  assert_eq!(query, TranscriptFuseQuestion);
}

/// **TWO SEATS, filled by two parties.** The knobs and the question are separate associated types,
/// so a request that changes no knob restates no knob — asserted by naming one without the other.
#[test]
fn the_knobs_and_the_question_are_two_independent_seats() {
  fn knobs_only<M: Fusable>(options: M::Options) -> M::Options {
    options
  }

  assert_eq!(
    knobs_only::<Transcript>(TranscriptFulltextOptions),
    TranscriptFulltextOptions,
  );
}

/// **NO BOUNDS ON EITHER SEAT.** A package that implements nothing at all still fills a seat, which
/// is what keeps *what a member's package must be* the member's own question.
#[test]
fn a_package_implementing_nothing_still_fills_a_seat() {
  struct Bare;
  struct Opaque;

  impl Fusable for Bare {
    type Options = Opaque;
    type Question = Opaque;
  }

  // Naming the projection is the assertion: a bound this trait does not ask for would be `E0277`
  // here, on a type carrying no derive at all.
  let _: <Bare as Fusable>::Options = Opaque;
  let _: <Bare as Fusable>::Question = Opaque;
}