indexbus_platform_ops/
errors.rs1use std::fmt;
9
10pub type Result<T> = std::result::Result<T, Error>;
12
13#[derive(Debug)]
14pub struct Error {
16 msg: String,
17}
18
19impl Error {
20 pub fn msg(msg: impl Into<String>) -> Self {
22 Self { msg: msg.into() }
23 }
24}
25
26impl fmt::Display for Error {
27 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
28 write!(f, "{}", self.msg)
29 }
30}
31
32impl std::error::Error for Error {}
33
34impl From<std::io::Error> for Error {
35 fn from(value: std::io::Error) -> Self {
36 Self::msg(value.to_string())
37 }
38}