Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
mod file;
mod in_memory;

pub use file::FileRepository;
pub use in_memory::InMemoryRepository;

use crate::entity::note::Note;

pub type NoteIterator<'repo> = Box<dyn Iterator<Item = Note> + 'repo>;

pub trait Repository {
    type Error: std::error::Error;

    fn insert(&mut self, note: Note) -> Result<Note, Self::Error>;
    fn list(&self) -> Result<NoteIterator<'_>, Self::Error>;
}