Trait FixedForInteger

Source
pub trait FixedForInteger {
    type FixedPoint: FixedPointNumber;
}
Expand description

Trait mapping primitive integer types to an appropriate fixed-point type.

This is useful in generic algorithms where a numeric type might need to be converted to a fixed-point representation for deterministic arithmetic, scaling, or computations.

Required Associated Types§

Source

type FixedPoint: FixedPointNumber

The fixed-point type corresponding to the integer type.

  • Small unsigned integers (u8, u16, u32) map to FixedU64
  • Large unsigned integers (u64, u128, usize) map to FixedU128
  • Signed integers follow a similar mapping with FixedI64 or FixedI128.

Implementations on Foreign Types§

Source§

impl FixedForInteger for i8

Source§

type FixedPoint = FixedI64

Source§

impl FixedForInteger for i16

Source§

type FixedPoint = FixedI64

Source§

impl FixedForInteger for i32

Source§

type FixedPoint = FixedI64

Source§

impl FixedForInteger for i64

Source§

type FixedPoint = FixedI128

Source§

impl FixedForInteger for i128

Source§

type FixedPoint = FixedI128

Source§

impl FixedForInteger for isize

Source§

type FixedPoint = FixedI128

Source§

impl FixedForInteger for u8

Source§

type FixedPoint = FixedU64

Source§

impl FixedForInteger for u16

Source§

type FixedPoint = FixedU64

Source§

impl FixedForInteger for u32

Source§

type FixedPoint = FixedU64

Source§

impl FixedForInteger for u64

Source§

type FixedPoint = FixedU128

Source§

impl FixedForInteger for u128

Source§

type FixedPoint = FixedU128

Source§

impl FixedForInteger for usize

Source§

type FixedPoint = FixedU128

Implementors§