10 — CRUD w pamięci (In-Memory Repository)
Zakres
- Operacje Create, Read, Update, Delete na strukturze domenowej
Task - Walidacja wejścia (pusty tytuł ->
RepoError::InvalidTitle) - Zarządzanie stanem i auto-inkrementacją ID w
BTreeMap<u64, Task>(deterministyczna kolejność)
Zadania (src/lib.rs)
Zaimplementuj TaskStore:
create(&mut self, title: impl Into<String>) -> Result<Task, RepoError>get(&self, id: u64) -> Option<&Task>list(&self) -> Vec<&Task>update_title(&mut self, id: u64, title: impl Into<String>) -> Result<Task, RepoError>mark_done(&mut self, id: u64) -> Result<Task, RepoError>delete(&mut self, id: u64) -> Result<Task, RepoError>
Uruchomienie testów
make test PKG=core10-crud-repository