Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions embedded-io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,14 @@ impl<E: fmt::Debug> fmt::Display for ReadExactError<E> {
}
}

impl<E: fmt::Debug> core::error::Error for ReadExactError<E> {}
impl<E: core::error::Error + 'static> core::error::Error for ReadExactError<E> {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match self {
Self::UnexpectedEof => None,
Self::Other(error) => Some(error),
}
}
}

/// Errors that could be returned by `Write` on `&mut [u8]`.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
Expand Down Expand Up @@ -294,7 +301,14 @@ impl<E: fmt::Debug> fmt::Display for WriteFmtError<E> {
}
}

impl<E: fmt::Debug> core::error::Error for WriteFmtError<E> {}
impl<E: core::error::Error + 'static> core::error::Error for WriteFmtError<E> {
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
match self {
Self::FmtError => None,
Self::Other(error) => Some(error),
}
}
}

/// Blocking reader.
///
Expand Down