[−][src]Function convert_byte_size_string::convert_to_bytes
pub fn convert_to_bytes(string: &str) -> Result<u128, ConversionError>
Convert the provided string to a u128 value containing the number of bytes represented by the string.
Arguments
string- The string to convert.
Returns
Err(ConversionError::InputInvalid)if the input was invalid. The String may contain more information.Err(ConversionError::TooLarge)if the
Example
use convert_byte_size_string::convert_to_bytes; assert_eq!(1024_u128, convert_to_bytes("1KiB").expect("a")); assert_eq!(1000_u128, convert_to_bytes("1KB").expect("b"));