mpris_server/
playback_status.rs1use std::fmt;
2
3use zbus::zvariant::{Type, Value};
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Type)]
7#[zvariant(signature = "s")]
8#[doc(alias = "Playback_Status")]
9pub enum PlaybackStatus {
10 Playing,
12 Paused,
14 Stopped,
16}
17
18impl PlaybackStatus {
19 pub fn as_str(&self) -> &'static str {
21 match self {
22 Self::Playing => "Playing",
23 Self::Paused => "Paused",
24 Self::Stopped => "Stopped",
25 }
26 }
27}
28
29impl fmt::Display for PlaybackStatus {
30 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31 f.write_str(self.as_str())
32 }
33}
34
35impl From<PlaybackStatus> for Value<'_> {
36 fn from(status: PlaybackStatus) -> Self {
37 Value::new(status.as_str())
38 }
39}