3 releases
0.1.2 | Aug 23, 2024 |
---|---|
0.1.1 | Aug 23, 2024 |
0.1.0 | Aug 23, 2024 |
#14 in #unit-conversion
27 downloads per month
1MB
109 lines
Contains (WOFF font, 400KB) NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2, (WOFF font, 135KB) FiraSans-Medium-8f9a781e4970d388.woff2, (WOFF font, 130KB) FiraSans-Regular-018c141bf0843ffd.woff2, (WOFF font, 82KB) SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2, (WOFF font, 77KB) SourceSerif4-Regular-46f98efaafac5295.ttf.woff2, (WOFF font, 45KB) SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 and 3 more.
Unit Converter for Rust Language
This library allows you to convert a size in bytes into kilobytes, megabytes, gigabytes, and terabytes, as well as perform conversions back to bytes.
Create a new ByteConverter
instance
bytes
: The number of bytes to be converted.
use data_storage_units::ByteConverter;
let converter = ByteConverter::new(1024);
Converts bytes to kilobytes (KB)
A tuple containing the value in kilobytes as f64
and the unit "KB".
let converter = ByteConverter::new(1024);
let (value, unit) = converter.to_kb();
Converts bytes to megabytes (MB)
A tuple containing the value in megabytes as f64
and the unit "MB".
let converter = ByteConverter::new(1073741824);
let (value, unit) = converter.to_mb();
Converts bytes to gigabytes (GB)
A tuple containing the value in gigabytes as f64
and the unit "GB".
let converter = ByteConverter::new(1073741824);
/let (value, unit) = converter.to_gb();
Converts bytes to terabytes (TB)
A tuple containing the value in terabytes as f64
and the unit "TB".
let converter = ByteConverter::new(1073741824);
let (value, unit) = converter.to_tb();