Impl PartialEq, Eq and Hash fo MetaData

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-07-27 20:19:05 +10:00
parent 2f27a5fd93
commit 4114b6e7c4
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -1,5 +1,5 @@
use std::{
fs,
fs, hash,
io::{self, Write},
iter::IntoIterator,
path::{Path, PathBuf},
@ -23,6 +23,21 @@ pub struct MetaData {
pub target: CompactString,
pub bins: Vec<CompactString>,
}
impl PartialEq for MetaData {
fn eq(&self, other: &MetaData) -> bool {
self.name == other.name
}
}
impl Eq for MetaData {}
impl hash::Hash for MetaData {
fn hash<H>(&self, state: &mut H)
where
H: hash::Hasher,
{
self.name.hash(state)
}
}
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
pub enum SourceType {