pub trait DppSectorPlugin: Send + Sync {
// Required methods
fn plugin_identity(&self) -> PluginIdentity;
fn schema_version_range(&self) -> SchemaVersionRange;
fn validate_input(&self, input: &PluginInput) -> Result<(), PluginError>;
fn calculate_metrics(
&self,
input: &PluginInput,
) -> Result<PluginResult, PluginError>;
fn generate_passport(
&self,
input: PluginInput,
) -> Result<Value, PluginError>;
// Provided methods
fn meta(&self) -> PluginMeta { ... }
fn capabilities(&self) -> PluginCapabilities { ... }
}Expand description
The entry points every sector plugin must export.
The Wasm host calls these after deserialising JSON sector data from the passport payload. Implementations must be deterministic and free of I/O.
Required Methods§
Sourcefn plugin_identity(&self) -> PluginIdentity
fn plugin_identity(&self) -> PluginIdentity
The fields that distinguish this plugin’s identity (see PluginIdentity).
Sourcefn schema_version_range(&self) -> SchemaVersionRange
fn schema_version_range(&self) -> SchemaVersionRange
The sector schema version range this plugin supports.
Sourcefn validate_input(&self, input: &PluginInput) -> Result<(), PluginError>
fn validate_input(&self, input: &PluginInput) -> Result<(), PluginError>
Validate the structure and field constraints of the sector input.
Returns Ok(()) if the input is structurally valid, or a descriptive
error if a required field is missing or out of range. Prefer
PluginError::ValidationErrors with per-field detail over
PluginError::InvalidInput for better error reporting.
Sourcefn calculate_metrics(
&self,
input: &PluginInput,
) -> Result<PluginResult, PluginError>
fn calculate_metrics( &self, input: &PluginInput, ) -> Result<PluginResult, PluginError>
Compute compliance metrics from the sector input.
May return None for fields that do not apply to this sector.
Sourcefn generate_passport(&self, input: PluginInput) -> Result<Value, PluginError>
fn generate_passport(&self, input: PluginInput) -> Result<Value, PluginError>
Generate a passport-ready sector data JSON payload.
Applies any normalisation or enrichment required by the sector schema
(e.g. rounding, unit conversion). The output is stored verbatim in the DPP.
Takes input by value — a pass-through implementation returns it
directly instead of cloning.
Provided Methods§
Sourcefn meta(&self) -> PluginMeta
fn meta(&self) -> PluginMeta
Returns static metadata about this plugin.
Built from Self::plugin_identity plus the fixed Odal Node
license/author/homepage convention. Override directly if a
plugin genuinely needs different values.
Sourcefn capabilities(&self) -> PluginCapabilities
fn capabilities(&self) -> PluginCapabilities
Returns the plugin’s capability declaration for version negotiation.
Built from Self::schema_version_range plus the standard
Validate/ComputeMetrics/GeneratePassport capability set every
plugin declares today. Override directly if a plugin needs a
different capability set or negotiation limits.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".