breaking: replace bytes with byte, upd parser, etc

This commit is contained in:
ge
2025-01-13 19:32:42 +03:00
parent 2f51ad63d7
commit 9206200515
5 changed files with 66 additions and 133 deletions

View File

@ -12,13 +12,16 @@ Example:
import dataunits
fn main() {
// convert via convert fn
kilobytes := dataunits.convert(500, dataunits.mbit, dataunits.kb)
println(kilobytes) // 62500.0
// convert via DataSize method (the arguments order matters)
mebibytes := (dataunits.gib * 15).mib()
println(mebibytes) // 15360.0
bytes := dataunits.DataSize(2000 * dataunits.gib).bytes()
// convert via DataSize method with explicit type cast
bytes := dataunits.DataSize(2000 * dataunits.gib).byte()
println(bytes) // 2.147483648e+12 == 2147483648000
}
```