Skip to main content

Module size

Module size 

Source
Expand description

Human-readable byte-count rendering.

Lives here, not in the CLI, so a codec’s --memory-limit refusal message and stuffr info’s resolved-limit display share one formatter rather than inventing their own — see the whole-branch review’s LOW-5 finding: before this, the same quantity (a declared or configured memory bound) appeared as raw bytes (xz_pure.rs, lzip.rs), KiB (lzma_pure.rs), and MiB/GiB (stuffr info) in the same build, which is exactly backwards for the one message a user reads to decide what to pass back to --memory-limit.

stuffr-cli’s size::parse_size is the inverse and stays in the CLI crate — it is flag-syntax (512M, 2G), not a general utility, and this crate has no reason to know what a command-line flag looks like. This function has no such reason to live above stuffr-core: it is pure arithmetic, with no format dependency, so codecs in stuffr-formats can use it directly for their own refusal messages.

Functions§

format_size
Renders a byte count the way a human reads it.