Skip to main content

FactorProvider

Trait FactorProvider 

Source
pub trait FactorProvider: Send + Sync {
    // Required methods
    fn dataset_id(&self) -> &str;
    fn dataset_version(&self) -> &str;
    fn gwp100(&self, activity_uuid: &str) -> Result<f64, CalcError>;
    fn table_hash(&self) -> &str;
}
Expand description

Provides lifecycle-inventory emission factors at runtime.

Implementations inject licensed datasets (ecoinvent, EF, Sphera) without bundling the underlying data in this Apache-2.0 crate — the methodology is open, the factor data is licensed and supplied at runtime.

A FactorProvider is intentionally not used by the Phase-0 calculators (repairability and the basic CO₂e cradle-to-gate), which take emission factors as caller-supplied inputs. It will be wired in Phase 2 when the battery CFB engine requires real LCI data.

Required Methods§

Source

fn dataset_id(&self) -> &str

Machine-readable identifier of the loaded dataset (e.g. "ecoinvent-3.10").

Source

fn dataset_version(&self) -> &str

Version string of the loaded dataset.

Source

fn gwp100(&self, activity_uuid: &str) -> Result<f64, CalcError>

GWP100 characterization factor for an activity identified by its dataset-internal UUID, in kg CO₂e per kg of substance emitted.

Source

fn table_hash(&self) -> &str

SHA-256 of the full serialised factor table, computed once at provider initialisation. Stored in the CalculationReceipt so a notified body can verify that the exact factor values are unchanged between calculations.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§