Module size::fmt

source · []
Expand description

The fmt module contains SizeFormatter and other types pertaining to formatting a size as human-readable text.

You will likely not need to interact with this module directly, as the functionality of a SizeFormatter is exposed by simply calling Size::format(). However, a new SizeFormatter can be instantiated directly if you would like a standalone pretty-printer for raw byte sizes.

The formatting-related enums in this module (Base and Style) are re-exported at the crate level as size::Base and size::Style.

Structs

A standalone size formatter that is configured via the builder pattern (via the various .with_ methods) which can then be used to format an integral byte value as a pretty printed String in accordance with the configured properties.

Enums

An enumeration of supported bases to use for generating textual descriptions of sizes.
An enumeration of supported styles to be used when formatting/printing a Size type, specifying how the unit should be spelled out.

Type Definitions

A type that can be used to achieve greater control over how a Size is formatted as human-readable text, created by calling Size::format(). The SizeFormatter follows the builder model and exposes a chaining API for configuration (via the .with_ functions).