From fcd9fc30d2fa41b2267a6539e5806735bae8931d Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 21 Mar 2021 14:30:17 -0700 Subject: make Opcode, Operand, and DecodeError non_exhaustive in the future these can and will change (new operands, new instructions) and i would prefer they not be major breaking changes. applications can ignore them and probably do undesired variants anyway. if you want to write a 1120-variant match, are you me? why would you do this --- src/protected_mode/mod.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/protected_mode') diff --git a/src/protected_mode/mod.rs b/src/protected_mode/mod.rs index 6394de0..a089fc2 100644 --- a/src/protected_mode/mod.rs +++ b/src/protected_mode/mod.rs @@ -366,6 +366,7 @@ enum SizeCode { } #[derive(Clone, Debug, PartialEq)] +#[non_exhaustive] pub enum Operand { ImmediateI8(i8), ImmediateU8(u8), @@ -782,6 +783,7 @@ const XSAVE: [Opcode; 10] = [ // UMWAIT #[allow(non_camel_case_types)] #[derive(Copy, Clone, Debug, Eq, PartialEq)] +#[non_exhaustive] pub enum Opcode { Invalid, ADD, @@ -1800,6 +1802,7 @@ impl yaxpeax_arch::Instruction for Instruction { } #[derive(Debug, PartialEq)] +#[non_exhaustive] pub enum DecodeError { ExhaustedInput, InvalidOpcode, -- cgit v1.1