Implemented Eq and Hash traits for definitions

This commit is contained in:
Valeryi Savich 2021-07-08 00:39:23 +02:00
parent d365ce0f7e
commit 66b2325e8a
1 changed files with 14 additions and 0 deletions

View File

@ -1,4 +1,5 @@
use std::fmt::{self, Debug, Formatter};
use std::hash::{Hash, Hasher};
use std::sync::Arc;
use uuid::Uuid;
@ -101,6 +102,19 @@ impl Debug for Definition {
}
}
impl Eq for Definition {}
impl PartialEq for Definition {
fn eq(&self, other: &Self) -> bool {
self.name == other.name
}
}
impl Hash for Definition {
fn hash<H: Hasher>(&self, state: &mut H) {
self.name.hash(state);
}
}
#[cfg(test)]
mod tests {
use crate::actor::definition::Definition;