qbt-clean 0.122.0

Automated rules-based cleaning of qBittorrent torrents.
#[serde_with::serde_as]
#[derive(Clone,Copy,PartialEq,Eq,PartialOrd,Ord,serde::Deserialize,serde::Serialize)]
#[serde(transparent)]
pub struct InfoHash(
	#[serde_as(as="serde_with::hex::Hex")] [u8; 20],
);

impl InfoHash {
	#[cfg(test)]
	pub fn example() -> Self {
		Self([0u8; 20])
	}
}

impl std::fmt::Display for InfoHash {
	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
		for b in self.0 {
			write!(f, "{:02x}", b)?;
		}
		Ok(())
	}
}

impl std::fmt::Debug for InfoHash {
	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
		write!(f, "InfoHash({})", self)
	}
}