Skip to main content

ByteSize

Type Alias ByteSize 

Source
pub type ByteSize = Information;
Expand description

A count of bytes: a message size, a segment size, a buffer capacity, a quota balance.

This is uom’s information dimension with f64 storage. The base unit is the byte, so ByteSizeExt::bytes_u64 is exact for every value the wire can carry. Construct with bytes, kibibytes, mebibytes, or gibibytes.

Aliased Type§

#[repr(transparent)]
pub struct ByteSize { pub dimension: PhantomData<dyn Dimension<Kind = dyn InformationKind, M = Z0, I = Z0, T = Z0, Th = Z0, N = Z0, L = Z0, J = Z0>>, pub units: PhantomData<dyn Units<f64, luminous_intensity = candela, amount_of_substance = mole, length = meter, electric_current = ampere, thermodynamic_temperature = kelvin, time = second, mass = kilogram>>, pub value: f64, }

Fields§

§dimension: PhantomData<dyn Dimension<Kind = dyn InformationKind, M = Z0, I = Z0, T = Z0, Th = Z0, N = Z0, L = Z0, J = Z0>>

Quantity dimension. See [Dimension].

§units: PhantomData<dyn Units<f64, luminous_intensity = candela, amount_of_substance = mole, length = meter, electric_current = ampere, thermodynamic_temperature = kelvin, time = second, mass = kilogram>>

Quantity base units. See [Units].

§value: f64

Quantity value stored in the base units for the quantity.

Trait Implementations§

Source§

impl ByteSizeExt for ByteSize

Source§

const ZERO: Self

No bytes.
Source§

fn from_bytes(bytes: u64) -> Self

A raw unsigned byte count.
Source§

fn from_bytes_i64(bytes: i64) -> Self

A raw signed byte count. This keeps the sign, so it also carries a delta, for example a quota balance that has gone into deficit. This function does not interpret Kafka’s -1 “unlimited” sentinel. Use wire::opt_size_from_bytes_i64 for that.
Source§

fn from_bytes_f64(bytes: f64) -> Self

A raw byte count measured as a float (a sampled or averaged size).
Source§

fn bytes_u64(self) -> u64

The count as an unsigned byte total.
Source§

fn bytes_usize(self) -> usize

The count as a usize, for buffer capacities and slice lengths.
Source§

fn bytes_i32(self) -> i32

The count as Kafka’s int32 byte fields (max_bytes, min_bytes).
Source§

fn bytes_i64(self) -> i64

The count as Kafka’s int64 byte fields (retention.bytes).
Source§

fn bytes_f64(self) -> f64

The count as a float, for metrics gauges.
Source§

impl Human for ByteSize

Source§

type Rendered = HumanByteSize

The Display adapter this quantity renders through.
Source§

fn human(self) -> Self::Rendered

This quantity, ready to print.