Expand description
powerio-pkg: the .pio.json compiler package.
PowerIO has no single flattened “universal network” struct. It has two concrete static-grid IR families that stay distinct:
powerio::BalancedNetwork(the scalar positive-sequence transmission model, historicallypowerio::Network);powerio_dist::MulticonductorNetwork(the wire-coordinate distribution model, historicallypowerio_dist::DistNetwork).
A CompilerPackage is the readable envelope that wraps exactly one of
those payloads at a time, alongside the metadata a compiler artifact needs
to be trustworthy: an explicit ModelKind, producer and origin metadata,
source maps, structured diagnostics, a validation summary, and lowering
history. It serializes to .pio.json. See docs/src/compiler-ir.md for the
architecture and docs/src/pio-json-schema.md for the field reference.
The package always carries CompilerPackage::model_kind explicitly; a
reader must never infer whether the payload is balanced or multiconductor
from which field is present. CompilerPackage::kind_is_consistent asserts
the explicit kind agrees with the payload variant.
use powerio_pkg::{CompilerPackage, ModelKind};
let net = powerio::BalancedNetwork::in_memory("demo", 100.0, vec![], vec![]);
let pkg = CompilerPackage::from_balanced(net);
assert_eq!(pkg.model_kind(), ModelKind::Balanced);
assert!(pkg.kind_is_consistent());
let json = pkg.to_json_pretty().unwrap();
let back = CompilerPackage::from_json(&json).unwrap();
assert_eq!(back.model_kind(), ModelKind::Balanced);Binary .pio is out of scope until the JSON package stabilizes; this crate
is JSON only.
Re-exports§
pub use diagnostics::DiagnosticCode;pub use diagnostics::DiagnosticSeverity;pub use diagnostics::DiagnosticStage;pub use diagnostics::StructuredDiagnostic;pub use lowering::LoweringRecord;pub use lowering::MulticonductorToBalancedError;pub use lowering::MulticonductorToBalancedLowering;pub use lowering::MulticonductorToBalancedOptions;pub use lowering::MulticonductorToBalancedReadiness;pub use lowering::SequenceTransformConvention;pub use lowering::check_multiconductor_to_balanced_lowering;pub use lowering::lower_multiconductor_to_balanced;pub use model::ModelKind;pub use model::ModelPayload;pub use package::CompilerPackage;pub use package::DerivedMetadata;pub use package::NormalizedSolverTableMetadata;pub use package::NormalizedSolverTableRowCounts;pub use package::NormalizedSolverTableSourceRows;pub use package::PIO_PACKAGE_SCHEMA_URL;pub use package::PIO_PACKAGE_SCHEMA_VERSION;pub use provenance::Confidence;pub use provenance::MappingKind;pub use provenance::Origin;pub use provenance::Producer;pub use provenance::SourceDescriptor;pub use provenance::SourceMapEntry;pub use provenance::SourceRef;pub use summary::ObjectSummary;pub use summary::ObjectTopology;pub use summary::ObjectUnits;pub use validation::ValidationCounts;pub use validation::ValidationPass;pub use validation::ValidationStatus;pub use validation::ValidationSummary;
Modules§
- diagnostics
- Structured diagnostics.
- lowering
- Lowering records and preflight checks.
- model
- The model kind and the single typed IR payload.
- package
- The
.pio.jsonroot object. - provenance
- Producer, origin, source descriptors, and source maps.
- summary
- A human-oriented summary of the payload.
- validation
- The package-level validation summary.