pub struct CompilerPackage {Show 15 fields
pub schema: String,
pub schema_version: String,
pub producer: Producer,
pub package_id: Option<String>,
pub created_at: Option<String>,
pub model_kind: ModelKind,
pub model: ModelPayload,
pub origin: Origin,
pub sources: Vec<SourceDescriptor>,
pub source_maps: Vec<SourceMapEntry>,
pub diagnostics: Vec<StructuredDiagnostic>,
pub validation: ValidationSummary,
pub summary: ObjectSummary,
pub lowering_history: Vec<LoweringRecord>,
pub derived: DerivedMetadata,
}Expand description
The compiler package: a versioned envelope around one IR payload plus the
provenance, diagnostics, validation, and lowering history that make the
artifact trustworthy. Serializes to .pio.json.
model_kind is stored explicitly and is authoritative; the payload is also
self-describing (tagged by kind). CompilerPackage::kind_is_consistent
asserts the two agree. Unknown future top-level fields are tolerated on read
(ignored) so a newer producer’s package still deserializes here.
Fields§
§schema: StringThe schema URL identifying this package format.
schema_version: StringThe package schema version (semver).
producer: Producer§package_id: Option<String>Stable content id, e.g. "sha256:...". The scaffold leaves it None.
created_at: Option<String>RFC 3339 build timestamp. Left None by default for deterministic,
round-trip-stable output; set explicitly when a timestamp is wanted.
model_kind: ModelKindExplicit model kind. Authoritative; never inferred from field presence.
model: ModelPayload§origin: Origin§sources: Vec<SourceDescriptor>§source_maps: Vec<SourceMapEntry>§diagnostics: Vec<StructuredDiagnostic>§validation: ValidationSummary§summary: ObjectSummary§lowering_history: Vec<LoweringRecord>§derived: DerivedMetadataImplementations§
Source§impl CompilerPackage
impl CompilerPackage
Sourcepub fn from_balanced(net: BalancedNetwork) -> Self
pub fn from_balanced(net: BalancedNetwork) -> Self
Wrap a balanced network. Origin is inferred from its source format:
InMemory / Derived (normalized) / File (a parsed text format,
recording whether source was retained; the path is not captured here).
Sourcepub fn from_multiconductor(net: MulticonductorNetwork) -> Self
pub fn from_multiconductor(net: MulticonductorNetwork) -> Self
Wrap a multiconductor network. Parse warnings are lifted into structured
diagnostics, and defaulted fields are lifted into source maps with
mapping_kind = defaulted, so the package surfaces that provenance even
though those parser-side fields are not part of the IR payload.
Sourcepub fn model_kind(&self) -> ModelKind
pub fn model_kind(&self) -> ModelKind
The explicit model kind.
Sourcepub fn kind_is_consistent(&self) -> bool
pub fn kind_is_consistent(&self) -> bool
Whether the explicit model_kind agrees with the payload variant. A
reader should reject a package where this is false.
Sourcepub fn as_balanced(&self) -> Option<&BalancedNetwork>
pub fn as_balanced(&self) -> Option<&BalancedNetwork>
The balanced payload, if this package carries one.
Sourcepub fn as_multiconductor(&self) -> Option<&MulticonductorNetwork>
pub fn as_multiconductor(&self) -> Option<&MulticonductorNetwork>
The multiconductor payload, if this package carries one.
Sourcepub fn to_json_pretty(&self) -> Result<String>
pub fn to_json_pretty(&self) -> Result<String>
Serialize to pretty .pio.json.
Sourcepub fn supports_schema_version(version: &str) -> bool
pub fn supports_schema_version(version: &str) -> bool
Whether this reader accepts the envelope schema version.
The .pio.json compatibility contract is envelope scoped: unknown
future top-level fields are ignored, additive same major versions load,
and a different major version is rejected before payload use.
pub fn with_origin(self, origin: Origin) -> Self
pub fn with_package_id(self, id: impl Into<String>) -> Self
pub fn with_created_at(self, created_at: impl Into<String>) -> Self
pub fn with_sources(self, sources: Vec<SourceDescriptor>) -> Self
pub fn with_source_maps(self, source_maps: Vec<SourceMapEntry>) -> Self
Sourcepub fn push_lowering(&mut self, record: LoweringRecord)
pub fn push_lowering(&mut self, record: LoweringRecord)
Append a lowering record to the history.
Sourcepub fn attach_normalized_solver_table_metadata(&mut self) -> Result<bool, Error>
pub fn attach_normalized_solver_table_metadata(&mut self) -> Result<bool, Error>
Attach compact metadata for the normalized dense solver table lowering.
Returns Ok(false) for non-balanced packages. The full table rows stay
outside the package payload; this records the pass name, row counts,
units, dense identities, and source row provenance a compiler cache needs
to validate external table artifacts.
Sourcepub fn with_normalized_solver_table_metadata(self) -> Result<Self, Error>
pub fn with_normalized_solver_table_metadata(self) -> Result<Self, Error>
Return a package with normalized solver table metadata attached.
Sourcepub fn check_multiconductor_to_balanced_lowering(
&self,
) -> Option<MulticonductorToBalancedReadiness>
pub fn check_multiconductor_to_balanced_lowering( &self, ) -> Option<MulticonductorToBalancedReadiness>
Check whether this package’s multiconductor payload is ready for the explicit multiconductor to balanced lowering pass.
Sourcepub fn lower_multiconductor_to_balanced(
&self,
options: MulticonductorToBalancedOptions,
) -> Result<Self, MulticonductorToBalancedError>
pub fn lower_multiconductor_to_balanced( &self, options: MulticonductorToBalancedOptions, ) -> Result<Self, MulticonductorToBalancedError>
Explicitly lower a multiconductor package to a derived balanced package.
This method only accepts packages whose payload is
ModelKind::Multiconductor. It does not mutate the input package.
Sourcepub fn run_sane_validation(&mut self)
pub fn run_sane_validation(&mut self)
Run the package semantic validation profile and record its findings.
This pass is non mutating: it reports structural and semantic issues in
diagnostics and validation.passes, but it never repairs or rewrites
the payload.
Trait Implementations§
Source§impl Clone for CompilerPackage
impl Clone for CompilerPackage
Source§fn clone(&self) -> CompilerPackage
fn clone(&self) -> CompilerPackage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more