Skip to main content

parse_memory_limit

Function parse_memory_limit 

Source
pub fn parse_memory_limit(s: &str) -> Result<u64>
Expand description

Parse --logical-graph-size-limit / RELATE_LOGICAL_GRAPH_SIZE_LIMIT sizes.

Integer bytes, or an integer plus b/bytes/mb/mib/gb/gib (case-insensitive, optional space). mb/gb are SI; mib/gib are IEC. 0 is unlimited at the call site.

use relate_core::parse_memory_limit;
assert_eq!(parse_memory_limit("1gib").unwrap(), 1 << 30);
assert_eq!(parse_memory_limit("2 mb").unwrap(), 2_000_000);