#[non_exhaustive]pub struct NetworkPackage {Show 18 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 payload_schema: Option<String>,
pub payload_schema_version: Option<String>,
pub model: ModelPayload,
pub operating_points: Option<OperatingPointSeries>,
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). NetworkPackage::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 (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.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.
payload_schema: Option<String>The declared schema URL for the payload family named by model_kind.
None on packages written before the payload contract was declared.
payload_schema_version: Option<String>The declared payload schema version (semver), independent of the
envelope schema_version: the envelope versions the package
bookkeeping, this versions the network tables. A reader rejects a
different major before computing on payload fields; None (legacy
packages) is accepted.
model: ModelPayload§operating_points: Option<OperatingPointSeries>Replayable operating states over the static payload. The package constructors and setters omit empty series for static single state cases.
origin: Origin§sources: Vec<SourceDescriptor>§source_maps: Vec<SourceMapEntry>§diagnostics: Vec<StructuredDiagnostic>§validation: ValidationSummary§summary: ObjectSummary§lowering_history: Vec<LoweringRecord>§derived: DerivedMetadataImplementations§
Source§impl NetworkPackage
impl NetworkPackage
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).
GOC3 sources also lift their time series into operating_points.
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 operating_points(&self) -> Option<&OperatingPointSeries>
pub fn operating_points(&self) -> Option<&OperatingPointSeries>
Replayable operating states over the static payload, when present.
Sourcepub fn with_operating_points(
self,
operating_points: OperatingPointSeries,
) -> Self
pub fn with_operating_points( self, operating_points: OperatingPointSeries, ) -> Self
Attach a format neutral operating point series to this package.
Sourcepub fn set_operating_points(&mut self, operating_points: OperatingPointSeries)
pub fn set_operating_points(&mut self, operating_points: OperatingPointSeries)
Attach or replace operating points in place. Empty series are omitted.
Sourcepub fn clear_operating_points(&mut self)
pub fn clear_operating_points(&mut self)
Remove operating points from this package.
Sourcepub fn materialize_operating_point(&self, index: usize) -> Result<Self>
pub fn materialize_operating_point(&self, index: usize) -> Result<Self>
Materialize one operating point into a static package.
The returned package has the same metadata and model kind, with its
payload updated for index, operating_points cleared, and sane
validation recomputed for the updated payload.
Sourcepub fn materialize_balanced_operating_point(
&self,
index: usize,
) -> Result<Option<BalancedNetwork>>
pub fn materialize_balanced_operating_point( &self, index: usize, ) -> Result<Option<BalancedNetwork>>
Materialize one operating point and return the balanced payload if this is a balanced package.
Sourcepub fn materialize_multiconductor_operating_point(
&self,
index: usize,
) -> Result<Option<MulticonductorNetwork>>
pub fn materialize_multiconductor_operating_point( &self, index: usize, ) -> Result<Option<MulticonductorNetwork>>
Materialize one operating point and return the multiconductor payload if this is a multiconductor package.
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 leaves the payload untouched: it reports structural and
semantic issues, but never repairs or rewrites the model. It does rewrite
the package’s own diagnostics and validation, so it needs &mut self.
Trait Implementations§
Source§impl Clone for NetworkPackage
impl Clone for NetworkPackage
Source§fn clone(&self) -> NetworkPackage
fn clone(&self) -> NetworkPackage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more