pub trait StrictlyMonotonicFn<External, Internal> {
    fn mapping(&self, inp: External) -> Internal;
    fn inverse(&self, out: Internal) -> External;
}
Expand description

Values need to be strictly monotonic mapped to a Internal value (u64 or u128) that can be used in fast field codecs.

The monotonic mapping is required so that PartialOrd can be used on Internal without converting to External.

All strictly monotonic functions are invertible because they are guaranteed to have a one-to-one mapping from their range to their domain. The inverse method is required when opening a codec, so a value can be converted back to its original domain (e.g. ip address or f64) from its internal representation.

Required Methods§

Strictly monotonically maps the value from External to Internal.

Inverse of mapping. Maps the value from Internal to External.

Implementors§