A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal
blob: faf85f1ea5c5de15a1461250ffc3b66f852e7274 (644 bytes)[doc][blame][raw]
1
use serde::Serialize;2
use std::fmt;4
#[derive(Debug, Clone, Serialize)]5
pub struct Error {6
message: String,7
}9
impl Error {10
#[must_use]11
pub fn new(message: &str) -> Self {12
Self {13
message: message.into(),14
}15
}16
}18
impl fmt::Display for Error {19
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {20
write!(f, "{}", self.message)21
}22
}24
impl From<std::io::Error> for Error {25
fn from(err: std::io::Error) -> Self {26
Self::new(&err.to_string())27
}28
}30
impl From<toml::de::Error> for Error {31
fn from(err: toml::de::Error) -> Self {32
Self::new(&err.to_string())33
}34
}