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
-1sentinel, which means “unlimited”, “none”, or “no bound” depending on the field, mapped to and fromOption.
Traits§
- Byte
Rate Ext - Byte throughputs: construction from raw integers, and extraction back to them.
- Byte
Size Ext - Byte counts: construction from raw integers, and extraction back to them.
- Frequency
Ext - Event rates: construction from raw numbers, and extraction back to them.
- Ratio
Ext - Dimensionless fractions.
- StdDuration
Ext - Converting a
Durationat an API boundary that hands one out. - TimeExt
- Time extents: construction from raw integers and
Duration, and extraction back to them.