mpd_easy/
lib.rs

1#![deny(clippy::pedantic)]
2#![allow(clippy::missing_errors_doc)]
3#![allow(clippy::missing_panics_doc)]
4use std::fmt;
5
6extern crate chrono;
7extern crate mpd;
8extern crate serde_json;
9
10use serde::Serialize;
11
12mod client;
13mod range;
14mod se;
15mod song;
16mod stats;
17mod status;
18mod time;
19
20pub use client::Client;
21pub use status::State;
22
23pub enum OutputFormat {
24    Text,
25    Json,
26    None,
27}
28
29#[derive(Debug, PartialEq, Serialize)]
30pub enum OnOff {
31    On,
32    Off,
33}
34
35impl From<bool> for OnOff {
36    fn from(value: bool) -> Self {
37        if value {
38            OnOff::On
39        } else {
40            OnOff::Off
41        }
42    }
43}
44
45impl fmt::Display for OnOff {
46    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
47        match self {
48            OnOff::On => write!(f, "on"),
49            OnOff::Off => write!(f, "off"),
50        }
51    }
52}