src/lib.rs
58 lines · 1374 bytes
1pub mod aniskip;
2use aniskip::SkipTime;
3
4pub struct Anime {
5 pub anilist_id: Option<i32>,
6 pub mal_id: Option<i32>,
7 pub allanime_id: Option<String>,
8 pub watching_ep: Option<i32>,
9 pub playing_time: Option<i32>,
10 pub skip_times: Option<Vec<SkipTime>>,
11}
12
13impl Anime {
14 // Constructor to create a new instance with fields initially set to None
15 pub fn new() -> Self {
16 Anime {
17 anilist_id: None,
18 mal_id: None,
19 allanime_id: None,
20 watching_ep: None,
21 playing_time: None,
22 skip_times: None,
23 }
24 }
25
26 pub fn anilist_id(&mut self, id: i32){
27 self.anilist_id = Some(id);
28 }
29
30 // Method to set the `mal_id`
31 pub fn mal_id(&mut self, id: i32){
32 self.mal_id = Some(id);
33 }
34
35 // Method to set the `allanime_id`
36 pub fn allanime_id(&mut self, id: String){
37 self.allanime_id = Some(id);
38 }
39
40 // Method to set the `watching_ep`
41 pub fn watching_ep(&mut self, ep: i32){
42 self.watching_ep = Some(ep);
43 }
44
45 // Method to set the `playing_time`
46 pub fn playing_time(&mut self, time: i32){
47 self.playing_time = Some(time);
48 }
49
50 // Method to set the `skip_times`
51 pub fn skip_times(&mut self, times: Vec<SkipTime>){
52 self.skip_times = Some(times);
53 }
54}
55
56pub struct Mpv {
57 pub speed: f32,
58}