From f1c6994d46da0b943bc36b9e707a16d5e4f0f783 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 28 Oct 2018 09:08:52 -0700 Subject: [PATCH] Enable using `Type` in a `HashMap` This commit adds `Hash` and `Eq` impls to `Type`, allowing it to be used as a key in a `HashMap` if desired. --- src/elements/types.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/elements/types.rs b/src/elements/types.rs index fade103..859e77c 100644 --- a/src/elements/types.rs +++ b/src/elements/types.rs @@ -7,7 +7,7 @@ use super::{ }; /// Type definition in types section. Currently can be only of the function type. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Hash, Eq)] pub enum Type { /// Function type. Function(FunctionType), @@ -32,7 +32,7 @@ impl Serialize for Type { } /// Value type. -#[derive(Clone, Copy, Debug, PartialEq)] +#[derive(Clone, Copy, Debug, PartialEq, Hash, Eq)] pub enum ValueType { /// 32-bit signed integer I32, @@ -136,7 +136,7 @@ impl Serialize for BlockType { } /// Function signature type. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Hash, Eq)] pub struct FunctionType { form: u8, params: Vec,