use crate::global::{structs::Item, traits::Collection}; use serde::{Deserialize, Serialize}; use typemap::Key; #[derive(Clone, Default, Serialize, Deserialize)] pub struct WatchHistory(pub Vec); impl Key for WatchHistory { type Value = Self; } impl Collection for WatchHistory { const INDEX_PATH: &'static str = ".local/share/youtube-tui/watch_history.json"; fn items(&self) -> &Vec { &self.0 } fn items_mut(&mut self) -> &mut Vec { &mut self.0 } fn from_items(items: Vec) -> Self { Self(items) } }