Skip to main content

Crate energyml_core

Crate energyml_core 

Source
Expand description

Runtime support for generated EnergyML crates.

This crate holds everything the generated eml / resqml / witsml / prodml crates lean on, and nothing schema-specific. It is deliberately free of native dependencies so generated code stays usable from wasm32.

What a generated type gets:

  • xml - namespace-aware XML reading and writing, with explicit control of prefixes and xsi:type. Serde handles JSON only.
  • reflect - a &'static TypeInfo per type: fields, XSD cardinality, facets, documentation, accepted types for polymorphic fields.
  • value - object-safe dynamic access, so a UI can walk and complete an instance it has no compile-time knowledge of.
  • path - Citation.Title style access, optionally case-insensitive.
  • validate - structural validation from the schema, plus a hook for business rules.
  • registry - create and read objects by content type or qualified type.
  • identity_owned - references attributed to the data object that writes them, stopping at nested data objects.
  • relations - where a type holds other data objects by value, and where it writes references: tables written by the generator, read by byte-level scanners.
  • identifiers - UUID, content type, qualified type and ETP URI parsing.

Generated code is written by energyml-codegen; the energyml-derive macros turn the annotated structs it emits into implementations of the traits above.

Re-exports§

pub use error::Error;
pub use error::Result;
pub use quick_xml;

Modules§

any_xml
A subtree the generator does not model, kept instead of dropped.
docs
The model’s documentation, as JSON - the reflection, serialized once.
error
Error type shared by serialization, reflection and validation.
identifiers
Energistics identifiers: UUID, content type, qualified type and ETP URI.
identity
Object identity, independent of the schema version it was read from.
identity_owned
References, attributed to the data object that writes them.
json
The EnergyML JSON encoding.
lexical
The lexical grammar of the XSD built-ins this model keeps as strings.
measure
Reading a measured value without knowing its type.
naming
Type naming: the obj_ prefix, and how names are compared.
ns
XML namespaces used by the Energistics schemas.
path
Dotted-path access into generated objects.
prelude
What generated code imports.
reflect
Static description of generated types.
registry
Runtime type registry.
relations
Static facts about where one data object holds another, or points at one.
truncate
Cutting a JSON document down to a budget, and saying what was cut.
validate
Validation.
value
Dynamic access to generated objects.
xml
XML reading and writing for generated types.

Constants§

CITATION_FORMAT
What every object this software writes says in Citation.Format.

Derive Macros§

EnergymlChoice
The derive macros, re-exported so use energyml_core::prelude::* is the only import generated code needs. Implement the EnergyML traits for an abstract type or substitution group.
EnergymlEnum
The derive macros, re-exported so use energyml_core::prelude::* is the only import generated code needs. Implement the EnergyML traits for an XSD simpleType enumeration.
EnergymlObject
The derive macros, re-exported so use energyml_core::prelude::* is the only import generated code needs. Implement the EnergyML traits for a struct mapped from an XSD complexType.