pub fn parse_bandwidth_str(s: &str) -> Option<u64>Expand description
Parse bandwidth from string (e.g., “100 Mbps”, “1 Gbps”).
§Examples
use chie_shared::parse_bandwidth_str;
// Parse different bandwidth units
assert_eq!(parse_bandwidth_str("100 bps"), Some(100));
assert_eq!(parse_bandwidth_str("10 Kbps"), Some(10_000));
assert_eq!(parse_bandwidth_str("100 Mbps"), Some(100_000_000));
assert_eq!(parse_bandwidth_str("1 Gbps"), Some(1_000_000_000));
// Case insensitive
assert_eq!(parse_bandwidth_str("50 MBPS"), Some(50_000_000));
// Invalid formats
assert_eq!(parse_bandwidth_str("invalid"), None);
assert_eq!(parse_bandwidth_str("100"), None); // Missing unit