Skip to main content

DppSectorPlugin

Trait DppSectorPlugin 

Source
pub trait DppSectorPlugin: Send + Sync {
    // Required methods
    fn meta(&self) -> PluginMeta;
    fn capabilities(&self) -> PluginCapabilities;
    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>;
}
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§

Source

fn meta(&self) -> PluginMeta

Returns static metadata about this plugin.

Source

fn capabilities(&self) -> PluginCapabilities

Returns the plugin’s capability declaration for version negotiation.

Source

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.

Source

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.

Source

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§