1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! [`ComplianceStrategy`] — the per-product-group determination seam.
use NaiveDate;
use crate;
use crateProductGroupData;
/// Per-product group compliance calculation strategy.
///
/// The Apache-2.0 build ships
/// [`PassthroughBatteryStrategy`](crate::passthrough::PassthroughBatteryStrategy)
/// and
/// [`PassthroughTextileStrategy`](crate::passthrough::PassthroughTextileStrategy),
/// both registered in
/// [`PassthroughRegistry::new`](crate::passthrough::PassthroughRegistry::new). A
/// proprietary tier registers its own for the product groups it models and leaves the
/// rest on passthrough.
///
/// This is the **per-product group** seam;
/// [`ComplianceRegistry`](crate::ports::compliance::ComplianceRegistry) is the whole-registry one. The distinction is the
/// useful granularity: a tier that computes a real battery determination still
/// wants passthrough for the product groups it does not model, and swapping the
/// registry to get one product group means reimplementing dispatch for all of them.
///
/// # Contract
///
/// An implementation receives the [`ProductGroupData`] for **its own** product group and
/// must return [`ComplianceErrorKind::InvalidInput`](crate::compliance::ComplianceErrorKind::InvalidInput) rather than panicking if
/// handed another's — a routing mistake in a host should be reportable, not
/// fatal.
///
/// # The governing-law date
///
/// `compute` takes the date the product was placed on the EU market, because a
/// strategy that computes anything must first decide *which rule applies*, and
/// that is a function of this date and never of today's. A strategy given only
/// the payload would have to read a clock to answer, and would then answer
/// differently on a Tuesday in 2031 than it did the day before, for a product
/// that had not changed.
///
/// It is `Option` because the date is a declaration a passport may omit, and
/// `None` is a real answer with a real consequence: the governing rule is
/// undetermined. It is **not** an invitation to substitute the current date.
///
/// The passthrough strategies ignore it, correctly — they compute nothing, so
/// there is no rule for them to select.