powerio-pkg
The .pio.json compiler package: a versioned envelope around one PowerIO IR
payload.
PowerIO has no single flattened "universal network" struct. It keeps two concrete static-grid IR families distinct:
powerio::BalancedNetwork— the scalar positive-sequence transmission model (historicallypowerio::Network);powerio_dist::MulticonductorNetwork— the wire-coordinate distribution model (historicallypowerio_dist::DistNetwork).
A CompilerPackage wraps exactly one of those payloads at a time and carries the
metadata a compiler artifact needs to be trustworthy:
- an explicit
model_kind(never inferred from which field is present); producerandoriginmetadata;sourcesandsource_maps(which canonical field came from which source record, by whatmapping_kind);- structured
diagnosticswith stable codes; - a
validationsummary; lowering_history;- optional
derivedmetadata for matrix stats, normalized solver table identities, and cache keys.
It serializes to .pio.json. Binary .pio is out of scope until the JSON
package stabilizes.
See docs/src/compiler-ir.md and docs/src/pio-json-schema.md in the
repository root.
use ;
let net = in_memory;
let pkg = from_balanced;
assert_eq!;
assert!;
let json = pkg.to_json_pretty.unwrap;
let back = from_json.unwrap;
assert_eq!;
Balanced packages can record the dense normalized solver table contract without embedding every table row:
let net = parse_str.unwrap.network;
let mut pkg = from_balanced;
pkg.attach_normalized_solver_table_metadata.unwrap;