src/global/structs/watchhistory.rs
24 lines · 513 bytes
1use crate::global::traits::Collection;
2
3use super::Item;
4use serde::{Deserialize, Serialize};
5use typemap::Key;
6
7#[derive(Clone, Default, Serialize, Deserialize)]
8pub struct WatchHistory(pub Vec<Item>);
9
10impl Key for WatchHistory {
11 type Value = Self;
12}
13
14impl Collection for WatchHistory {
15 const INDEX_PATH: &'static str = ".local/share/youtube-tui/watch_history.json";
16
17 fn items(&self) -> &Vec<Item> {
18 &self.0
19 }
20
21 fn items_mut(&mut self) -> &mut Vec<Item> {
22 &mut self.0
23 }
24}