use std::fmt;
use zbus::zvariant::{Type, Value};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Type)]
#[zvariant(signature = "s")]
#[doc(alias = "Playback_Status")]
pub enum PlaybackStatus {
Playing,
Paused,
Stopped,
}
impl PlaybackStatus {
pub fn as_str(&self) -> &'static str {
match self {
Self::Playing => "Playing",
Self::Paused => "Paused",
Self::Stopped => "Stopped",
}
}
}
impl fmt::Display for PlaybackStatus {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
impl<'a> From<PlaybackStatus> for Value<'a> {
fn from(status: PlaybackStatus) -> Self {
Value::new(status.as_str())
}
}