src/structs/listitem.rs

641938ba1f255069a13382c2a2903a32612e3873
youtube-tui/src/structs/listitem.rs history · blame · raw

21 lines · 475 bytes

 1
 2use crate::structs::{MiniVideo, FullVideo};
 3
 4#[derive(Debug, Clone)]
 5pub enum ListItem {
 6    MiniVideo(MiniVideo),
 7    FullVideo(FullVideo),
 8    PageTurner(bool), // true: +1 | false: -1
 9}
10
11impl ListItem {
12    pub fn id(&self) -> String {
13        match self {
14            ListItem::MiniVideo(video) => video.video_id.clone(),
15            ListItem::FullVideo(video) => video.video_id.clone(),
16            _ => {
17                unreachable!()
18            }
19        }
20    }
21}