Skip to main content

Module sizes

Module sizes 

Source
Expand description

Docker-style size strings for VM sizing flags (--memory, --disk-size).

Accepts <number><unit> with exact units b/k/m/g/t (case-insensitive, optional b/ib suffix forms: 512m, 4g, 4GB, 4gib; decimals like 1.5g too). Anything else fails loudly — including bare digits at this layer (see the parse_memory_mb / parse_disk_gb fallbacks below for why those accept them).

All arithmetic is checked integer math (u128 intermediates): no float precision holes near u64::MAX.

Constants§

MIN_DISK_GB
Minimum install-disk size in GB: below this the image cannot be laid down.
MIN_MEMORY_MB
Minimum guest RAM in MB: below this Windows 11 cannot boot to Setup. (The 4 GB Windows spec stays the recommended default, not the floor.)

Functions§

parse_disk_gb
Parse --disk-size: Docker syntax, or bare digits meaning GB. Enforces the disk floor.
parse_memory_mb
Parse --memory: Docker syntax, or bare digits meaning MB (back-compat with the old integer flag). Enforces the RAM floor. Clap value_parser shape: Err(String) renders as a clean CLI error.
parse_size_bytes
Parse a Docker-style size string into bytes. Bare digits are rejected here (in real Docker syntax they mean bytes, a guaranteed footgun for VM sizing); the typed wrappers below give them safe meanings.