diff options
author | 2016-09-27 15:43:11 +0200 | |
---|---|---|
committer | 2016-09-27 15:43:11 +0200 | |
commit | bb86b201ddc4164beb4a8539fe8d912d37e21a22 (patch) | |
tree | 30928a2eaaf3eda45c8ec2fe2eb94365eaf03d97 | |
parent | 03417d713789fe8931d51baafa0ff392569977bf (diff) | |
download | rust-x86-bb86b201ddc4164beb4a8539fe8d912d37e21a22.tar.gz rust-x86-bb86b201ddc4164beb4a8539fe8d912d37e21a22.tar.zst rust-x86-bb86b201ddc4164beb4a8539fe8d912d37e21a22.zip |
Implement equality and Debug for types.
Signed-off-by: Gerd Zellweger <mail@gerdzellweger.com>
-rw-r--r-- | src/shared/perfcnt/intel/description.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/shared/perfcnt/intel/description.rs b/src/shared/perfcnt/intel/description.rs index 9d2c74d..b316f88 100644 --- a/src/shared/perfcnt/intel/description.rs +++ b/src/shared/perfcnt/intel/description.rs @@ -1,5 +1,6 @@ use std::fmt; +#[derive(Eq, PartialEq)] pub enum PebsType { Regular, PebsOrRegular, @@ -17,6 +18,7 @@ impl fmt::Debug for PebsType { } } +#[derive(Eq, PartialEq)] pub enum Tuple { One(u8), Two(u8, u8), @@ -31,6 +33,7 @@ impl fmt::Debug for Tuple { } } +#[derive(Eq, PartialEq)] pub enum MSRIndex { None, One(u64), @@ -47,7 +50,7 @@ impl fmt::Debug for MSRIndex { } } -#[derive(Clone, Copy)] +#[derive(Clone, Copy, Eq, PartialEq)] pub enum Counter { /// Bit-mask containing the fixed counters /// usable with the corresponding performance event. @@ -274,3 +277,9 @@ impl EventDescription { } } } + +impl fmt::Display for EventDescription { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.event_name) + } +} |