indexbus_blocking/
errors.rs1use indexbus_core::Error as CoreError;
2
3pub type Result<T> = core::result::Result<T, Error>;
5
6#[derive(Debug)]
7pub enum Error {
9 Core(CoreError),
11 Wait(indexbus_wake::WaitError),
13 MissingBlockingCapability,
15}
16
17impl From<CoreError> for Error {
18 fn from(value: CoreError) -> Self {
19 Self::Core(value)
20 }
21}
22
23impl From<indexbus_wake::WaitError> for Error {
24 fn from(value: indexbus_wake::WaitError) -> Self {
25 Self::Wait(value)
26 }
27}
28
29#[cfg(feature = "std")]
30impl std::fmt::Display for Error {
31 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
32 match self {
33 Self::Core(e) => write!(f, "core error: {e:?}"),
34 Self::Wait(e) => write!(f, "wait error: {e}"),
35 Self::MissingBlockingCapability => {
36 write!(f, "layout missing INDEXBUS_CAP_SUPPORTS_BLOCKING")
37 }
38 }
39 }
40}
41
42#[cfg(feature = "std")]
43impl std::error::Error for Error {}