Crates.io | data_storage_units |
lib.rs | data_storage_units |
version | 0.1.2 |
source | src |
created_at | 2024-08-23 10:08:53.442262 |
updated_at | 2024-08-23 10:42:29.652253 |
description | Unit converter for rust language |
homepage | https://github.com/encoderuz/unit_converter |
repository | https://github.com/encoderuz/unit_converter |
max_upload_size | |
id | 1349001 |
size | 1,317,842 |
ByteConverter
instancebytes
: The number of bytes to be converted.
use data_storage_units::ByteConverter;
let converter = ByteConverter::new(1024);
A tuple containing the value in kilobytes as f64
and the unit "KB".
let converter = ByteConverter::new(1024);
let (value, unit) = converter.to_kb();
A tuple containing the value in megabytes as f64
and the unit "MB".
let converter = ByteConverter::new(1073741824);
let (value, unit) = converter.to_mb();
A tuple containing the value in gigabytes as f64
and the unit "GB".
let converter = ByteConverter::new(1073741824);
/let (value, unit) = converter.to_gb();
A tuple containing the value in terabytes as f64
and the unit "TB".
let converter = ByteConverter::new(1073741824);
let (value, unit) = converter.to_tb();