Crate bandwidth

source ·
Expand description

Bandwidth Speed quantification.

Examples:

There are multiple ways to create a new 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));

Structs

A Bandwidth type to represent a link’s bandwidth(to describe how many bits can be sent on the link per second), typically used for network.
An error which can be returned when converting a floating-point value of gbps into a Bandwidth.