Skip to main content

Module cgr_reader

Module cgr_reader 

Source
Expand description

CGR-based Cap’n Proto schema parser.

Reads binary CodeGeneratorRequest (CGR) files produced by capnp compile via build.rs, and produces ParsedSchema with full wire format info.

Advantages over text parsing:

  • Full type resolution (struct names resolved via node graph)
  • Native annotation extraction (no text stripping hacks)
  • Deterministic output (BTreeMap for node ordering)
  • Wire format offsets (data_words, pointer_words, slot_offset) for codegen
  • Discriminant values available directly

Constants§

MAXLEN_ZERO_CONTRACT_ERROR
Build a FieldDef from a Slot field reader.

Functions§

is_primitive_type
Check if a type name is a primitive (not a struct reference).
parse_from_cgr
Parse a schema from a CGR binary file in OUT_DIR (for proc-macro use).
parse_from_cgr_path
Parse a schema from a CGR binary file at a given path.