Description
Implement Isbn13 as a ValueObject in the identifiers module.
Spec: ISBN-13 with check digit
Implementation checklist
Implementation detail
Input / Output
|
Type |
Alias |
| Input |
String |
Isbn13Input |
| Output |
String |
Isbn13Output |
Normalization
Strip hyphens and spaces; keep only digits. Output is 13 bare digits.
Validation
- Exactly 13 digits after stripping.
- Must start with
978 or 979.
- Check digit validated using the EAN-13 algorithm (alternating weights 1 and 3, total mod 10 == 0).
Extra methods
prefix() -> &str — returns "978" or "979" (first 3 digits).
References
Description
Implement
Isbn13as aValueObjectin theidentifiersmodule.Spec: ISBN-13 with check digit
Implementation checklist
src/identifiers/isbn13.rsValueObjecttrait#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]src/identifiers/mod.rsandprelude# ExampleblockROADMAP.mdfrom ⬜ to ✅Implementation detail
Input / Output
StringIsbn13InputStringIsbn13OutputNormalization
Strip hyphens and spaces; keep only digits. Output is 13 bare digits.
Validation
978or979.Extra methods
prefix() -> &str— returns"978"or"979"(first 3 digits).References