Add non_exhaustive attrs.

This commit is contained in:
Dario Nieuwenhuis 2021-01-09 00:51:07 +01:00
parent e18d71dedc
commit 60df9e0d38
2 changed files with 2 additions and 24 deletions

View file

@ -2,12 +2,11 @@ use core::future::Future;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[non_exhaustive]
pub enum Error {
Failed,
AddressMisaligned,
BufferMisaligned,
_NonExhaustive,
}
pub trait Flash {

View file

@ -1,9 +1,7 @@
/// Categories of errors that can occur.
///
/// This list is intended to grow over time and it is not recommended to
/// exhaustively match against it.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[non_exhaustive]
pub enum Error {
/// An entity was not found, often a file.
NotFound,
@ -142,22 +140,3 @@ impl core::fmt::Display for Error {
#[cfg(feature = "std")]
impl std::error::Error for Error {}
/*
impl From<smoltcp::Error> for Error {
fn from(err: smoltcp::Error) -> Error {
match err {
smoltcp::Error::Exhausted => Error::Exhausted,
smoltcp::Error::Illegal => Error::Illegal,
smoltcp::Error::Unaddressable => Error::Unaddressable,
smoltcp::Error::Truncated => Error::Truncated,
smoltcp::Error::Checksum => Error::Checksum,
smoltcp::Error::Unrecognized => Error::Unrecognized,
smoltcp::Error::Fragmented => Error::Fragmented,
smoltcp::Error::Malformed => Error::Malformed,
smoltcp::Error::Dropped => Error::Dropped,
_ => Error::Other,
}
}
}
*/