/// Construct a new DataSize passing the amount of `bytes`
/// we want to convert
Construct a new DataSize passing the amount of `bytes`
we want to convert
Construct a new DataSize passing the amount of ` bytes ` we want to convert
pub fn from_bytes(bytes: usize) -> DataSize {
        if bytes < 1024 {
            DataSize::Bytes(bytes as f64)
        } else if bytes < (1024 * 1024) {
            DataSize::KiB(bytes as f64 / 1024.0)
        } else if bytes < (1024 * 1024 * 1024) {
            DataSize::MiB(bytes as f64 / (1024 * 1024) as f64)
        } else {
            DataSize::GiB(bytes as f64 / (1024 * 1024 * 1024) as f64)
        }
    }
pub fn from_bytes ( bytes : usize ) -> DataSize { if bytes < 1024 { DataSize :: Bytes ( bytes as f64 ) } else if bytes < ( 1024 * 1024 ) { DataSize :: KiB ( bytes as f64 / 1024.0 ) } else if bytes < ( 1024 * 1024 * 1024 ) { DataSize :: MiB ( bytes as f64 / ( 1024 * 1024 ) as f64 ) } else { DataSize :: GiB ( bytes as f64 / ( 1024 * 1024 * 1024 ) as f64 ) } }
Construct a new DataSize passing the amount of `bytes`
we want to convert
Construct a new DataSize passing the amount of ` bytes ` we want to convert
bytes
usize