capnp_store: declarative serialization via macros

Replace 130 lines of manual field-by-field capnp serialization with
two declarative macros:

  capnp_enum!  — generates to_capnp/from_capnp for enum types
  capnp_message! — generates from_capnp/to_capnp for structs

Adding a field to the capnp schema now means adding it in one place;
both read and write directions are generated from the same declaration.

Eliminates: read_content_node, write_content_node, read_relation,
write_relation, read_provenance (5 functions → 2 macro invocations).

Callers updated to method syntax: Node::from_capnp() / node.to_capnp().

Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
ProofOfConcept 2026-03-03 12:25:10 -05:00
parent ec8b4b2ed2
commit ea0d631051
3 changed files with 115 additions and 136 deletions

View file

@ -16,6 +16,7 @@ rkyv = { version = "0.7", features = ["validation", "std"] }
memmap2 = "0.9"
rayon = "1"
peg = "0.8"
paste = "1"
[build-dependencies]
capnpc = "0.20"