1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
use thiserror::Error; #[derive(Error, Debug)] pub enum Error { #[error("system error or I/O failure")] IoFailure(#[from] std::io::Error), #[error("the implementation returns malformed strings")] InvalidString(#[from] std::string::FromUtf8Error), #[error("failed to parse the string returned from implementation")] UnexpectedOutput(&'static str), #[error("cannot find any dialog implementation (kdialog/zanity)")] NoImplementation, #[error("the implementation reports error")] ImplementationError(String), } pub type Result<T> = std::result::Result<T, Error>; pub trait Dialog { type Output; fn show(self) -> Result<Self::Output>; } mod message; pub use message::*; mod file; pub use file::*; mod r#impl;