Files

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:

  1. create(&mut self, title: impl Into<String>) -> Result<Task, RepoError>
  2. get(&self, id: u64) -> Option<&Task>
  3. list(&self) -> Vec<&Task>
  4. update_title(&mut self, id: u64, title: impl Into<String>) -> Result<Task, RepoError>
  5. mark_done(&mut self, id: u64) -> Result<Task, RepoError>
  6. delete(&mut self, id: u64) -> Result<Task, RepoError>

Uruchomienie testów

make test PKG=core10-crud-repository