A library for representing bandwidth speed in a variety of units, mimicking the core::time::Duration
struct.]
More detailed usage can be found on documentation.
```rust use bandwidth::Bandwidth;
let fivegbps = Bandwidth::fromgbps(5); asserteq!(fivegbps, Bandwidth::frommbps(5000)); asserteq!(fivegbps, Bandwidth::fromkbps(5000000)); asserteq!(fivegbps, Bandwidth::frombps(5000000_000));
let tengbps = Bandwidth::fromgbps(10); let sevenbps = Bandwidth::frombps(7); let total = tengbps + sevenbps; assert_eq!(total, Bandwidth::new(10, 7)); ```
You should follow our Code of Conduct.
See CONTRIBUTING GUIDELINES for contributing conventions.
Make sure to pass all the tests before submitting your code.
Yixin Shen |
Apache-2.0 © stack-rs