Expand description

A collection of constants for base-2 and base-10 units.

These can be used in a const context in conjunction with the const Size::from_const() function to create strongly-sized Size objects expressing various sizes, e.g.

use size::Size;
use size::consts::*;

pub const TOTAL_SIZE: Size = Size::from_const(3 * MiB);

Constants

Abbreviated “byte” constant. Identical to BYTE.
Basic “byte” constant, used across all bases.
Abbreviated base-10 “exabyte” constant, equal to 1000 petabytes. Identical to EXABYTE.
Base-10 “exabyte” constant, equal to 1000 petabytes.
Base-2 “exbibyte” constant, equal to 2^60 bytes.
Abbreviated base-2 “exbibyte” constant, equal to 1024 pebibytes. Identical to EXBIBYTE.
Abbreviated base-10 “gigabyte” constant, equal to 1000 megabytes. Identical to GIGABYTE.
Base-2 “gibibyte” constant, equal to 2^30 bytes.
Base-10 “gigabyte” constant, equal to 1000 megabytes.
Abbreviated base-2 “gibibyte” constant, equal to 1024 mebibytes. Identical to GIBIBYTE.
Abbreviated base-10 “kilobyte” constant, equal to 1000 bytes. Identical to KILOBYTE.
Base-2 “kibibyte” constant, equal to 2^10 bytes.
Base-10 “kilobyte” constant, equal to 1000 bytes.
Abbreviated base-2 “kibibyte” constant, equal to 1024 bytes. Identical to KIBIBYTE.
Abbreviated base-10 “megabyte” constant, equal to 1000 kilobytes. Identical to MEGABYTE.
Base-2 “mebibyte” constant, equal to 2^20 bytes.
Base-10 “megabyte” constant, equal to 1000 kilobytes.
Abbreviated base-2 “mebibyte” constant, equal to 1024 kibibytes. Identical to MEBIBYTE.
Abbreviated base-10 “petabyte” constant, equal to 1000 terabytes. Identical to PETABYTE.
Base-2 “pebibyte” constant, equal to 2^50 bytes.
Base-10 “petabyte” constant, equal to 1000 terabytes.
Abbreviated base-2 “pebibyte” constant, equal to 1024 tebibytes. Identical to PEBIBYTE.
Abbreviated base-10 “terabyte” constant, equal to 1000 gigabytes. Identical to TERABYTE.
Base-2 “tebibyte” constant, equal to 2^40 bytes.
Base-10 “terabyte” constant, equal to 1000 gigabytes.
Abbreviated base-2 “tebibyte” constant, equal to 1024 gibibytes. Identical to TEBIBYTE.