Skip to main content

selene_daemon/
loop_mode.rs

1use std::fmt::Display;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
6#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
7pub enum LoopMode {
8    /// Disables looping
9    None,
10
11    /// When the end of the tracklist is reached, loop back to the beginning
12    Loop,
13
14    /// When the end of the tracklist is reached, reshuffle the tracklist using the shuffle mode and loop
15    LoopAndReshuffle,
16
17    /// When the end of the current track is reached, repeat
18    RepeatTrack,
19}
20
21impl Display for LoopMode {
22    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23        match self {
24            LoopMode::None => f.write_str("None"),
25            LoopMode::Loop => f.write_str("Loop"),
26            LoopMode::LoopAndReshuffle => f.write_str("Loop And Reshuffle"),
27            LoopMode::RepeatTrack => f.write_str("Repeat Track"),
28        }
29    }
30}