Description
Implement Issn as a ValueObject in the identifiers module.
Spec: ISSN with check digit
Implementation checklist
Implementation detail
Input / Output
|
Type |
Alias |
| Input |
String |
IssnInput |
| Output |
String |
IssnOutput |
Normalization
Strip spaces and hyphens; keep only digits and a possible trailing X. Format the output as XXXX-XXXX (with the hyphen reinserted after the 4th character).
Validation
- Exactly 8 characters after stripping (7 digits + check character which is
0–9 or X).
- Check character validated using ISSN weighted sum: multiply each of the first 7 digits by weights 8 down to 2, sum them, check character makes the total mod 11 == 0 (
X represents 10).
Extra methods
None beyond the trait. value() returns the formatted XXXX-XXXX string.
References
Description
Implement
Issnas aValueObjectin theidentifiersmodule.Spec: ISSN with check digit
Implementation checklist
src/identifiers/issn.rsValueObjecttrait#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]src/identifiers/mod.rsandprelude# ExampleblockROADMAP.mdfrom ⬜ to ✅Implementation detail
Input / Output
StringIssnInputStringIssnOutputNormalization
Strip spaces and hyphens; keep only digits and a possible trailing
X. Format the output asXXXX-XXXX(with the hyphen reinserted after the 4th character).Validation
0–9orX).Xrepresents 10).Extra methods
None beyond the trait.
value()returns the formattedXXXX-XXXXstring.References