1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! zapc — ZAP schema compiler.
//!
//! Parses `.zap` schema files into an in-memory IR (`Schema`) and
//! emits Rust readers/writers via `codegen::emit_rust`. Hand-rolled
//! parser — no dependency on upstream Cap'n Proto tooling.
//!
//! # Schema syntax
//!
//! ```text
//! @0xc0a8b5e0e5f0a000; // file id (random 64-bit, hex)
//!
//! struct KeysSnapshot {
//! application @0 :Text;
//! seq @1 :UInt64;
//! jwksJson @2 :Data;
//! }
//!
//! struct Ping { nonce @0 :UInt64; }
//! ```
//!
//! Supported types: `Bool`, `UInt8/16/32/64`, `Int8/16/32/64`,
//! `Float32/64`, `Text` (UTF-8 string), `Data` (byte slice).
//!
//! Each field has a stable index. The on-wire layout is the canonical
//! ZAP packing (matches Go luxfi/zap):
//!
//! - Fixed-size primitives are packed at the field offset (computed
//! from field index × max(field-size, alignment)).
//! - `Text` and `Data` store an i32 LE relative offset + u32 LE
//! length at the field offset; payload bytes follow the struct.
//! - Structs are 8-byte aligned.
pub use emit_rust;
pub use ;
pub type Result<T> = Result;
/// Convenience for build.rs callers — parse + emit in one shot.
///
/// `out_path` is typically `concat!(env!("OUT_DIR"), "/zap_schema.rs")`.