| 117 | |
| 118 | impl Unit { |
| 119 | fn factor(&self) -> u64 { |
| 120 | match self { |
| 121 | Self::Byte => 1, |
| 122 | // decimal units |
| 123 | Self::KiloByte => crate::KB, |
| 124 | Self::MegaByte => crate::MB, |
| 125 | Self::GigaByte => crate::GB, |
| 126 | Self::TeraByte => crate::TB, |
| 127 | Self::PetaByte => crate::PB, |
| 128 | Self::ExaByte => crate::EB, |
| 129 | // binary units |
| 130 | Self::KibiByte => crate::KIB, |
| 131 | Self::MebiByte => crate::MIB, |
| 132 | Self::GibiByte => crate::GIB, |
| 133 | Self::TebiByte => crate::TIB, |
| 134 | Self::PebiByte => crate::PIB, |
| 135 | Self::ExbiByte => crate::EIB, |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | mod impl_ops { |