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

1
Cargo.lock generated
View file

@ -1018,6 +1018,7 @@ dependencies = [
"faer",
"libc",
"memmap2",
"paste",
"peg",
"rayon",
"regex",