qbt-clean 0.3.0

Automated rules-based cleaning of qBittorrent torrents.
pub struct FmtBytes(pub u64);

impl std::fmt::Display for FmtBytes {
	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
		let mut prefix = 0;
		let mut whole = self.0;
		let mut fracional = 0;
		while whole >= 1000 && prefix < crate::SI_PREFIXES.len() {
			fracional = whole % 1024;
			whole /= 1024;
			prefix += 1;
		}
		if prefix == 0 {
			write!(f, "{} B", self.0)
		} else {
			write!(f,
				"{}.{:02}{}iB",
				whole,
				fracional * 100 / 1024,
				&crate::SI_PREFIXES[(prefix - 1)..][..1])
		}
	}
}