usize

package
v3.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 0 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

usize

Byte-sized data unit constants.

Use decimal units for SI sizes and binary units for power-of-two sizes:

Example

const databaseLoadChunkSize = 8 * usize.MiB
const payloadLimit = 10 * usize.MB

Short aliases are available for byte units (KB, MB, KiB, MiB) and bit units (Mbit, Mibit). Bit units are represented as byte counts.

Documentation

Overview

Package usize provides byte-sized data unit constants.

Index

Constants

View Source
const (
	Byte = 1
	B    = Byte
)
View Source
const (
	Kilobyte = 1000 * Byte
	Megabyte = 1000 * Kilobyte
	Gigabyte = 1000 * Megabyte
	Terabyte = 1000 * Gigabyte
	Petabyte = 1000 * Terabyte
)
View Source
const (
	Kibibyte = 1024 * Byte
	Mebibyte = 1024 * Kibibyte
	Gibibyte = 1024 * Mebibyte
	Tebibyte = 1024 * Gibibyte
	Pebibyte = 1024 * Tebibyte
)
View Source
const (
	KB = Kilobyte
	MB = Megabyte
	GB = Gigabyte
	TB = Terabyte
	PB = Petabyte
)
View Source
const (
	KiB = Kibibyte
	MiB = Mebibyte
	GiB = Gibibyte
	TiB = Tebibyte
	PiB = Pebibyte
)
View Source
const (
	Kilobit = Kilobyte / 8
	Megabit = Megabyte / 8
	Gigabit = Gigabyte / 8
	Terabit = Terabyte / 8
	Petabit = Petabyte / 8
)
View Source
const (
	Kibibit = Kibibyte / 8
	Mebibit = Mebibyte / 8
	Gibibit = Gibibyte / 8
	Tebibit = Tebibyte / 8
	Pebibit = Pebibyte / 8
)
View Source
const (
	Kbit = Kilobit
	Mbit = Megabit
	Gbit = Gigabit
	Tbit = Terabit
	Pbit = Petabit
)
View Source
const (
	Kibit = Kibibit
	Mibit = Mebibit
	Gibit = Gibibit
	Tibit = Tebibit
	Pibit = Pebibit
)

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL