ingraph-derive
The attribute and derive macros for ingraph — the words a
record, node, key, filter and vocabulary declaration is written in.
You probably do not want to depend on this crate. ingraph re-exports the whole family at its
own root behind its default derive feature, so a declaration reads #[ingraph::record(…)] and
names one dependency. This crate is published because that re-export needs something to point at,
and for the rare consumer that reaches the attributes directly.
0.1 is a first cut
Everything here may change or disappear in a later 0.x. The grammar these macros accept, what
they emit, and the names of the emitted items are all still moving. No API is settled, no migration
is promised, and there is no deprecation cycle to rely on.
Installation
[]
= "0.1" # the door you want
# ingraph-derive = "0.1" # only if you are reaching the attributes directly
Reaching the attributes directly means naming ingraph's runtime tier yourself: an expansion
writes ::ingraph::__private::… absolutely, and ingraph's own derive feature is what normally
implies the tier those paths land in.
One example
use Uuid;
That expands into KeyframeKey, KeyframeLineage, an accessor family on each, From<Record> and
From<&Record> conversions, impl Transformer and impl Identifiable on the record and on the key
both, the per-database row and comparison lowering, the order-by vocabulary, the keyset cursor, and
the record's query unit.
Why attributes rather than derives
A derive is handed a copy of the declaration and may only append. These macros need to change the item they sit on — a derived index carries an identity it does not mint, as one field whose type is a projection, and that field has to be in the struct rather than beside it — so the whole family is attribute macros, and a declaration's options are the attribute's arguments.
License
ingraph-derive is under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.