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)] #[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))] #[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[non_exhaustive]
pub enum Error { pub enum Error {
Failed, Failed,
AddressMisaligned, AddressMisaligned,
BufferMisaligned, BufferMisaligned,
_NonExhaustive,
} }
pub trait Flash { pub trait Flash {

View File

@ -1,9 +1,7 @@
/// Categories of errors that can occur. /// 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)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))] #[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[non_exhaustive]
pub enum Error { pub enum Error {
/// An entity was not found, often a file. /// An entity was not found, often a file.
NotFound, NotFound,
@ -142,22 +140,3 @@ impl core::fmt::Display for Error {
#[cfg(feature = "std")] #[cfg(feature = "std")]
impl std::error::Error for Error {} 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,
}
}
}
*/