# Bandwidth
[](https://github.com/stack-rs/bandwidth)
[](https://crates.io/crates/bandwidth)
[](https://docs.rs/bandwidth)
[](https://github.com/stack-rs/bandwidth/blob/main/LICENSE)
A library for representing bandwidth speed in a variety of units, mimicking the `core::time::Duration` struct.]
## Usage
More detailed usage can be found on [documentation](https://docs.rs/bandwidth).
```rust
use bandwidth::Bandwidth;
let five_gbps = Bandwidth::from_gbps(5);
assert_eq!(five_gbps, Bandwidth::from_mbps(5_000));
assert_eq!(five_gbps, Bandwidth::from_kbps(5_000_000));
assert_eq!(five_gbps, Bandwidth::from_bps(5_000_000_000));
let ten_gbps = Bandwidth::from_gbps(10);
let seven_bps = Bandwidth::from_bps(7);
let total = ten_gbps + seven_bps;
assert_eq!(total, Bandwidth::new(10, 7));
```
## Maintainer
[@BobAnkh](https://github.com/BobAnkh)
## How to contribute
You should follow our [Code of Conduct](/CODE_OF_CONDUCT.md).
See [CONTRIBUTING GUIDELINES](/CONTRIBUTING.md) for contributing conventions.
Make sure to pass all the tests before submitting your code.
### Contributors
<table>
<tr>
<td align="center" style="word-wrap: break-word; width: 150.0; height: 150.0">
<a href=https://github.com/BobAnkh>
<img src=https://avatars.githubusercontent.com/u/44333669?v=4 width="100;" style="border-radius:50%;align-items:center;justify-content:center;overflow:hidden;padding-top:10px" alt=Yixin Shen/>
<br />
<sub style="font-size:14px"><b>Yixin Shen</b></sub>
</a>
</td>
</tr>
</table>
## LICENSE
[Apache-2.0](LICENSE) © stack-rs