tray_icon_win/
error.rs

1use std::fmt;
2use std::io;
3
4#[non_exhaustive]
5/// Errors returned by tray-icon.
6#[derive(Debug)]
7pub enum Error {
8    OsError(io::Error),
9    NotMainThread,
10}
11
12impl core::fmt::Display for Error {
13    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14        match self {
15            Error::OsError(err) => write!(f, "OS error: {}", err),
16            Error::NotMainThread => write!(f, "Not on the main thread"),
17        }
18    }
19}
20
21impl std::error::Error for Error {}
22
23/// Convenient type alias of Result type for tray-icon.
24pub type Result<T> = core::result::Result<T, Error>;