From b8cad8254385272e1cd6d7ab04b11c88b21da54e Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Fri, 22 Sep 2017 06:00:28 +0700 Subject: [PATCH] Derive PartialEq and PartialOrd for enums. Fixes #163. --- src/Language/Rust/Corrode/C.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Language/Rust/Corrode/C.md b/src/Language/Rust/Corrode/C.md index 3ae88cf..c5263a1 100644 --- a/src/Language/Rust/Corrode/C.md +++ b/src/Language/Rust/Corrode/C.md @@ -3737,11 +3737,12 @@ environment. Like `struct` above, `enum` needs both `Copy` and `Clone`. But we also force each `enum` to be represented just like `enumReprType`, defined -above. +above. Since these are enumerations with numeric values, it is also +useful for them to derive `PartialEq` and `PartialOrd`. ```haskell let Rust.TypeName repr = toRustType enumReprType - let attrs = [ Rust.Attribute "derive(Clone, Copy)" + let attrs = [ Rust.Attribute "derive(Clone, Copy, PartialEq, PartialOrd)" , Rust.Attribute (concat [ "repr(", repr, ")" ]) ] when shouldEmit $