Skip to main content

dpp_domain/
lib.rs

1//! `dpp-domain` — EU Digital Product Passport domain types and port traits.
2//!
3//! This crate is the dependency root of the DPP workspace. Every other crate
4//! depends on this one. It depends only on `dpp-rules` (pure regulatory rules).
5//!
6//! No I/O, no async, no HTTP, no database drivers — pure domain logic only.
7
8/// The version of `dpp-core` this build was compiled against.
9///
10/// All core crates share one version (lockstep), so this crate's version is the
11/// workspace's. A consumer cannot otherwise discover it: `CARGO_PKG_VERSION`
12/// resolves to the *calling* crate. Platforms embedding this library record it
13/// alongside their own version so a compliance determination can be traced to
14/// the code that computed it.
15pub const VERSION: &str = env!("CARGO_PKG_VERSION");
16
17pub mod access;
18pub mod catalog;
19pub mod compliance;
20pub mod domain;
21pub mod ports;
22pub mod schemas;
23#[cfg(test)]
24mod test_support;
25
26pub use catalog::{CatalogError, RegulatoryStatus, SectorCatalog, SectorDescriptor};
27
28pub use domain::{
29    error::DppError,
30    gtin::{Gln, GlnError, Gtin, GtinError, gs1_check_digit},
31    identity::{
32        Audience, Disclosure, PASSPORT_FIELD_DISCLOSURE, PassportCredential,
33        PassportCredentialSubject, SignedCredential,
34    },
35    lint::{LintFinding, LintResult, LintSeverity, lint_sector_data},
36    passport::{
37        FacilitySnapshot, ManufacturerInfo, MaterialEntry, Passport, PassportId, PassportView,
38        ProductCategory,
39    },
40    product_identity::ProductIdentity,
41    sector::{
42        AluminiumData, BatteryChemistry, BatteryData, BatteryType, CarbonFootprint,
43        CarbonFootprintClass, CarbonFootprintClassError, ConstructionData, DetergentData,
44        ElectronicsData, EnergyEfficiencyClass, ExpectedLifetime, FibreEntry, FurnitureData,
45        HarmfulEvents, LifecycleStage, MaterialComposition, ProductionRoute, RepairCriterion,
46        RepairabilityScore, Sector, SectorData, StateOfHealth, SteelData, SurfactantEntry,
47        SvhcSubstance, SystemBoundary, TextileData, ToyData, TyreData, UnsoldGoodsDestination,
48        UnsoldGoodsReason, UnsoldGoodsReport, redact_sector_data, validate_fibre_composition,
49        validate_surfactants, validate_svhc_substances,
50    },
51    status::PassportStatus,
52    transfer::{
53        OperatorRole, ResponsibleOperator, TransferChain, TransferError, TransferReason,
54        TransferRecord, TransferStatus,
55    },
56};
57
58pub use domain::field_error::{FieldError, ValidationErrors};
59
60#[cfg(not(target_arch = "wasm32"))]
61pub use domain::validation::{
62    BatchValidationItem, SectorValidator, SectorValidatorRegistry, batch_errors,
63    validate_raw_sector_data, validate_sector_data, validate_sector_data_batch,
64    validate_sector_data_with_registry,
65};
66
67pub use ports::archive::{
68    ArchivePort, ArchiveReceipt, ArchiveStatus, ArchiveVerification, GhostArchive,
69};
70pub use ports::compliance::{
71    ComplianceError, ComplianceErrorKind, ComplianceFinding, ComplianceRegistry, ComplianceResult,
72    ComplianceStatus, ComplianceStrategy, gate_determination,
73};
74pub use ports::registry_sync::{
75    GhostRegistrySync, RegistrationRequest, RegistryIdentifiers, RegistryRecord, RegistryStatus,
76    RegistrySyncPort,
77};
78
79pub use compliance::passthrough_registry::PassthroughRegistry;
80
81/// Compile-checks this crate's README examples.
82///
83/// A README example is a public claim about the API, and nothing else in the
84/// build compiles one. Without this, a README can advertise a function that
85/// does not exist — which is exactly what happened before this harness landed.
86#[cfg(doctest)]
87#[doc = include_str!("../README.md")]
88struct ReadmeDoctests;