use compact_str::CompactString;
use serde::Deserialize;
use std::hash::Hash;
use std::{borrow::Borrow, collections::HashSet, hash::Hasher};
use url::Url;
#[derive(Eq, Deserialize, Debug)]
pub struct Artifact {
pub name: CompactString,
pub url: Url,
pub browser_download_url: String,
}
impl PartialEq for Artifact {
fn eq(&self, other: &Self) -> bool {
self.name.eq(&other.name)
}
}
impl Hash for Artifact {
fn hash<H>(&self, state: &mut H)
where
H: Hasher,
{
let s: &str = self.name.as_str();
s.hash(state)
}
}
impl Borrow<str> for Artifact {
fn borrow(&self) -> &str {
&self.name
}
}
#[derive(Debug, Default, Deserialize)]
pub struct Artifacts {
pub assets: HashSet<Artifact>,
}