Repository navigation
v0.14.0
Everything in this release is additive and lives behind a //go:build go1.27
constraint. go.mod stays at Go 1.22; on older toolchains the new symbols do
not exist and the existing API is unchanged. Hand-written parsers and
compilers remain supported.
Added
Model[T]with the generic methodField[U](Type[U], getter, setter).
One method replaces the per-type builder methods and the
XField/XFieldGetter/XFieldSetterconstructors. AModel[T]is a
Type[T], so nested structs are plain fields.Parse,ParseBytesand
Compilelive on the model.Registry[ID], aType[Entry[ID]]that maps ids to models.
Register[U](id, *Model[U])is typed at compile time. Nests as a field.cmd/parco-gen: a code generator that readsparcostruct tags and writes
theModelfor every tagged struct (go generatefriendly, stdlib only).
Wire types are inferred from Go types; tags adjust byte order, header size,
time location, or skip a field.examples/codegenwith the generator input, its committed output and a
roundtrip test; the generator's golden test regenerates it.- CI matrix covers Go 1.26 and 1.27 so the constrained files are compiled and
tested.
Changed
OptionalTypeimplementsByteLength, soOption(...)is aType[U]and
can be passed toModel.Field.
Measured
Compile benchmark, Compiler versus Model over the same struct, 10 runs on
go1.27.2: small 450.4 ns vs 447.5 ns, medium 2.546 us vs 2.548 us, large
25.23 us vs 25.24 us. Bytes, allocations and payload identical between the
two in every row.