From 6039e0c76997014ed3f78768f8558da98d373e4b Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sun, 6 Sep 2020 12:57:16 +0200 Subject: Make *Error, Model, DeviceWrapper non-exhaustive Previously, all enums defined by the nitrokey crate were exhaustive. This means that adding new variants to these enums is a breaking change. To make it possible to add new features to nitrokey-rs without breaking compatibility, this patch marks the Error, CommandError, CommunicationError, LibraryError, Model and DeviceWrapper enums as non-exhaustive. --- src/error.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/error.rs') diff --git a/src/error.rs b/src/error.rs index 64a2ce0..f1e91c3 100644 --- a/src/error.rs +++ b/src/error.rs @@ -11,6 +11,7 @@ use crate::device; /// An error returned by the nitrokey crate. #[derive(Debug)] +#[non_exhaustive] pub enum Error { /// An error reported by the Nitrokey device in the response packet. CommandError(CommandError), @@ -111,6 +112,7 @@ impl fmt::Display for Error { /// An error reported by the Nitrokey device in the response packet. #[derive(Clone, Copy, Debug, PartialEq)] +#[non_exhaustive] pub enum CommandError { /// A packet with a wrong checksum has been sent or received. WrongCrc, @@ -177,6 +179,7 @@ impl fmt::Display for CommandError { /// A device communication error. #[derive(Clone, Copy, Debug, PartialEq)] +#[non_exhaustive] pub enum CommunicationError { /// Could not connect to a Nitrokey device. NotConnected, @@ -215,6 +218,7 @@ impl fmt::Display for CommunicationError { /// A library usage error. #[derive(Clone, Copy, Debug, PartialEq)] +#[non_exhaustive] pub enum LibraryError { /// A supplied string exceeded a length limit. StringTooLong, -- cgit v1.2.1