Skip to main content

Module convert

Module convert 

Source
Expand description

Conversions between quantities and the raw numbers at the edges of the system.

Quantities live in the hand-written domain layer. At its edges the value must be a plain integer, float, or core::time::Duration. Those edges are the generated Kafka codec, an on-disk record, a tokio timer, and a Prometheus gauge. These extension traits are that seam, so this module states the rounding and saturation rules once instead of at every boundary.

Conversions into a quantity are exact for every magnitude Kafka can express. Conversions out round to nearest and saturate at the target type’s bounds instead of wrapping, and they map NaN to zero.

Modules§

wire
Kafka’s -1 sentinel, which means “unlimited”, “none”, or “no bound” depending on the field, mapped to and from Option.

Traits§

ByteRateExt
Byte throughputs: construction from raw integers, and extraction back to them.
ByteSizeExt
Byte counts: construction from raw integers, and extraction back to them.
FrequencyExt
Event rates: construction from raw numbers, and extraction back to them.
RatioExt
Dimensionless fractions.
StdDurationExt
Converting a Duration at an API boundary that hands one out.
TimeExt
Time extents: construction from raw integers and Duration, and extraction back to them.