mirror of https://github.com/bastion-rs/bastion
Implemented Eq and Hash traits for definitions
This commit is contained in:
parent
d365ce0f7e
commit
66b2325e8a
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue