# Bandwidth [![github-repo](https://img.shields.io/badge/github-stack--rs/bandwidth-f5dc23?logo=github)](https://github.com/stack-rs/bandwidth) [![crates.io](https://img.shields.io/crates/v/bandwidth.svg?logo=rust)](https://crates.io/crates/bandwidth) [![docs.rs](https://img.shields.io/badge/docs.rs-bandwidth-blue?logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K)](https://docs.rs/bandwidth) [![LICENSE Apache-2.0](https://img.shields.io/github/license/stack-rs/bandwidth?logo=Apache)](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. **MSRV**: 1.60 This library supports `no_std` and `serde`. `std` are enabled by default. ## 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
Yixin
Yixin Shen
## LICENSE [Apache-2.0](LICENSE) © stack-rs