Skip to main content

Module size

Module size 

Source
Expand description

Human-readable size parsing and platform presets.

Sizes (8MB, 500KB, 1.5GB) → bytes. Decimal units (KB/MB/GB) use 1000, binary units (KiB/MiB/GiB) use 1024. Decimal is the deliberate default: for the same number it is smaller than binary, so a “≤ 8 MB” goal stays conservative even on platforms that mean 8 MiB when they say “8 MB”.

Structs§

Preset
A platform preset: a name and a hard limit in bytes (if any).

Enums§

SizeError
Errors from parsing a size or a percent.

Functions§

parse_percent
Parse a percent like 70% or 70 into the fraction 0.70. Range is strictly (0, 100).
parse_size
Parse a size like 8MB, 500KB, 1.5GB, 1024KiB, 900000 into bytes.
preset
Look up a preset by name. Limit values are TO BE VERIFIED AT RELEASE: platforms change them.