indexbus_wake/
errors.rs

1/// Errors returned by platform wait primitives.
2#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3pub enum WaitError {
4    /// The wait timed out.
5    TimedOut,
6    /// The wait was interrupted (e.g. by a signal).
7    Interrupted,
8    /// A platform error code (errno on Unix; `GetLastError` on Windows).
9    OsError(u32),
10    /// Blocking waits are not supported on this platform/target.
11    Unsupported,
12}
13
14#[cfg(feature = "std")]
15impl std::fmt::Display for WaitError {
16    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17        match self {
18            Self::TimedOut => write!(f, "timed out"),
19            Self::Interrupted => write!(f, "interrupted"),
20            Self::OsError(code) => write!(f, "os error: {code}"),
21            Self::Unsupported => write!(f, "unsupported platform"),
22        }
23    }
24}
25
26#[cfg(feature = "std")]
27impl std::error::Error for WaitError {}