Skip to main content

parse_size_bytes

Function parse_size_bytes 

Source
pub fn parse_size_bytes(formatted_bytes: &str) -> Option<u64>
Expand description

Returns the number of bytes represented by a human readable string like “123.4k”, 123.4 * 1024 bytes encoded in |formatted_bytes|.

If |formatted_bytes| is not correctly formatted then |None| is returned.

This is a reverse function of |format_size| input |bytes|. Except that it considers absence of unit (e.g. “123”) to be in bytes(implicit B).