Skip to content

Commit

Permalink
uefi-raw: Derive Ord, PartialOrd, and Hash for all newtype enums
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasbishop committed Jul 3, 2023
1 parent 7cfaf19 commit a10c385
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions uefi-raw/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
///
/// This macro implements Debug for you, the way you would expect it to work on
/// Rust enums (printing the variant name instead of its integer value). It also
/// derives Clone, Copy, Eq and PartialEq, since that always makes sense for
/// C-style enums and is used by the implementation. If you want anything else
/// derives Clone, Copy, Eq, PartialEq, Ord, PartialOrd, and Hash, since those
/// always make sense for C-style enums. If you want anything else
/// to be derived, you can ask for it by adding extra derives as shown in the
/// example below.
///
Expand Down Expand Up @@ -53,7 +53,7 @@ macro_rules! newtype_enum {
) => {
$(#[$type_attrs])*
#[repr(transparent)]
#[derive(Clone, Copy, Eq, PartialEq)]
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
$visibility struct $type(pub $base_integer);

$(#[$impl_attrs])*
Expand Down
1 change: 0 additions & 1 deletion uefi-raw/src/table/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ newtype_enum! {
/// in the 0x70000000..0xFFFFFFFF range. Therefore, we don't know the full set
/// of memory types at compile time, and it is _not_ safe to model this C enum
/// as a Rust enum.
#[derive(PartialOrd, Ord, Hash)]
pub enum MemoryType: u32 => {
/// This enum variant is not used.
RESERVED = 0,
Expand Down

0 comments on commit a10c385

Please sign in to comment.