use std::fmt::{self, Display, Formatter};
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum ByteUnit {
B,
KB,
KiB,
MB,
MiB,
GB,
GiB,
TB,
TiB,
PB,
PiB,
}
impl Display for ByteUnit {
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
match self {
ByteUnit::B => f.write_str("B"),
ByteUnit::KB => f.write_str("KB"),
ByteUnit::KiB => f.write_str("KiB"),
ByteUnit::MB => f.write_str("MB"),
ByteUnit::MiB => f.write_str("MiB"),
ByteUnit::GB => f.write_str("GB"),
ByteUnit::GiB => f.write_str("GiB"),
ByteUnit::TB => f.write_str("TB"),
ByteUnit::TiB => f.write_str("TiB"),
ByteUnit::PB => f.write_str("PB"),
ByteUnit::PiB => f.write_str("PiB"),
}
}
}