feat(domain): implement RelayId newtype with validation

Implement smart constructor that validates relay IDs are within valid 
range (1-8 for 8-channel relay controller). Add accessor method as_u8() 
for safe access to inner value. Add comprehensive documentation to satisfy 
clippy requirements.

TDD green phase: Tests from T017 now pass.

Ref: T018 (specs/001-modbus-relay-control/tasks.md)
This commit is contained in:
2026-01-03 22:34:36 +01:00
parent 86b194ad74
commit 0ec7fdf11b
5 changed files with 41 additions and 1 deletions

View File

@@ -211,7 +211,7 @@
- **File**: src/domain/relay.rs
- **Complexity**: Low | **Uncertainty**: Low
- [ ] **T018** [US1] [TDD] Implement RelayId newtype with validation
- [x] **T018** [US1] [TDD] Implement RelayId newtype with validation
- #[repr(transparent)] newtype wrapping u8
- Constructor validates 1..=8 range
- Implement Display, Debug, Clone, Copy, PartialEq, Eq