Skip to main content

UnderlyingInt

Trait UnderlyingInt 

Source
pub trait UnderlyingInt:
    Sized
    + Clone
    + Copy
    + Debug
    + Display
    + PartialEq
    + Eq
    + PartialOrd
    + Ord
    + Add<Output = Self>
    + Sub<Output = Self>
    + Div<Output = Self>
    + Rem<Output = Self>
    + Mul<Output = Self>
    + Shl<u32, Output = Self>
    + Shr<u32, Output = Self>
    + BitOr<Output = Self>
    + BitAnd<Output = Self>
    + BitXor<Output = Self>
    + AddAssign
    + SubAssign {
    type Signed: Display;

    const MAX: Self;
    const ZERO: Self;
    const ONE: Self;
    const TEN: Self;
    const HUNDRED: Self;
    const UNSIGNED_MAX_MATISSA: Self;
    const SIGNED_MAX_MATISSA: Self;
    const SIGNED_MIN_UNDERINT: Self;
    const BITS: u32;
    const SCALE_BITS: u32;
    const MAX_SCALE: u32 = _;

    // Required methods
    fn to_signed(self, sign: u8) -> Self::Signed;
    fn from_signed(s: Self::Signed) -> (Self, u8);
    fn as_u32(self) -> u32;
    fn from_u32(n: u32) -> Self;
    fn leading_zeros(self) -> u32;
    fn mul_exp(self, iexp: u32) -> Self;
    fn checked_mul_exp(self, iexp: u32) -> Option<Self>;
    fn div_exp(self, iexp: u32) -> Self;
    fn div_rem_exp(self, iexp: u32) -> (Self, Self);
    fn mul_with_sum_scale<const S: bool>(
        self,
        right: Self,
        sum_scale: u32,
    ) -> Option<(Self, u32)>;
    fn div_with_scales<const S: bool>(
        self,
        d: Self,
        s_scale: u32,
        d_scale: u32,
    ) -> Option<(Self, u32)>;
}
Expand description

Underlying integer type.

Required Associated Constants§

Source

const MAX: Self

Source

const ZERO: Self

Source

const ONE: Self

Source

const TEN: Self

Source

const HUNDRED: Self

Source

const UNSIGNED_MAX_MATISSA: Self

Source

const SIGNED_MAX_MATISSA: Self

Source

const SIGNED_MIN_UNDERINT: Self

Source

const BITS: u32

Source

const SCALE_BITS: u32

Provided Associated Constants§

Source

const MAX_SCALE: u32 = _

Required Associated Types§

Required Methods§

Source

fn to_signed(self, sign: u8) -> Self::Signed

Source

fn from_signed(s: Self::Signed) -> (Self, u8)

Source

fn as_u32(self) -> u32

Source

fn from_u32(n: u32) -> Self

Source

fn leading_zeros(self) -> u32

Source

fn mul_exp(self, iexp: u32) -> Self

Source

fn checked_mul_exp(self, iexp: u32) -> Option<Self>

Source

fn div_exp(self, iexp: u32) -> Self

Source

fn div_rem_exp(self, iexp: u32) -> (Self, Self)

Source

fn mul_with_sum_scale<const S: bool>( self, right: Self, sum_scale: u32, ) -> Option<(Self, u32)>

Source

fn div_with_scales<const S: bool>( self, d: Self, s_scale: u32, d_scale: u32, ) -> Option<(Self, u32)>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl UnderlyingInt for u32

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TEN: Self = 10

Source§

const HUNDRED: Self = 100

Source§

const MAX: Self = Self::MAX

Source§

const UNSIGNED_MAX_MATISSA: Self

Source§

const SIGNED_MAX_MATISSA: Self

Source§

const SIGNED_MIN_UNDERINT: Self

Source§

const BITS: u32 = 32

Source§

const SCALE_BITS: u32 = 3

Source§

type Signed = i32

Source§

fn to_signed(self, sign: u8) -> Self::Signed

Source§

fn from_signed(s: Self::Signed) -> (Self, u8)

Source§

fn as_u32(self) -> u32

Source§

fn from_u32(n: u32) -> Self

Source§

fn leading_zeros(self) -> u32

Source§

fn mul_exp(self, iexp: u32) -> Self

Source§

fn checked_mul_exp(self, iexp: u32) -> Option<Self>

Source§

fn div_exp(self, iexp: u32) -> Self

Source§

fn div_rem_exp(self, iexp: u32) -> (Self, Self)

Source§

fn mul_with_sum_scale<const S: bool>( self, right: Self, sum_scale: u32, ) -> Option<(Self, u32)>

Source§

fn div_with_scales<const S: bool>( self, d: Self, s_scale: u32, d_scale: u32, ) -> Option<(Self, u32)>

Source§

impl UnderlyingInt for u64

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TEN: Self = 10

Source§

const HUNDRED: Self = 100

Source§

const MAX: Self = Self::MAX

Source§

const UNSIGNED_MAX_MATISSA: Self

Source§

const SIGNED_MAX_MATISSA: Self

Source§

const SIGNED_MIN_UNDERINT: Self

Source§

const BITS: u32 = 64

Source§

const SCALE_BITS: u32 = 4

Source§

type Signed = i64

Source§

fn to_signed(self, sign: u8) -> Self::Signed

Source§

fn from_signed(s: Self::Signed) -> (Self, u8)

Source§

fn as_u32(self) -> u32

Source§

fn from_u32(n: u32) -> Self

Source§

fn leading_zeros(self) -> u32

Source§

fn mul_exp(self, iexp: u32) -> Self

Source§

fn checked_mul_exp(self, iexp: u32) -> Option<Self>

Source§

fn div_exp(self, iexp: u32) -> Self

Source§

fn div_rem_exp(self, iexp: u32) -> (Self, Self)

Source§

fn mul_with_sum_scale<const S: bool>( self, right: Self, sum_scale: u32, ) -> Option<(Self, u32)>

Source§

fn div_with_scales<const S: bool>( self, d: Self, s_scale: u32, d_scale: u32, ) -> Option<(Self, u32)>

Source§

impl UnderlyingInt for u128

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TEN: Self = 10

Source§

const HUNDRED: Self = 100

Source§

const MAX: Self = Self::MAX

Source§

const UNSIGNED_MAX_MATISSA: Self

Source§

const SIGNED_MAX_MATISSA: Self

Source§

const SIGNED_MIN_UNDERINT: Self

Source§

const BITS: u32 = 128

Source§

const SCALE_BITS: u32 = 5

Source§

type Signed = i128

Source§

fn to_signed(self, sign: u8) -> Self::Signed

Source§

fn from_signed(s: Self::Signed) -> (Self, u8)

Source§

fn as_u32(self) -> u32

Source§

fn from_u32(n: u32) -> Self

Source§

fn leading_zeros(self) -> u32

Source§

fn mul_exp(self, iexp: u32) -> Self

Source§

fn checked_mul_exp(self, iexp: u32) -> Option<Self>

Source§

fn div_exp(self, iexp: u32) -> Self

Source§

fn div_rem_exp(self, iexp: u32) -> (Self, Self)

Source§

fn mul_with_sum_scale<const S: bool>( self, right: Self, sum_scale: u32, ) -> Option<(Self, u32)>

Source§

fn div_with_scales<const S: bool>( self, d: Self, s_scale: u32, d_scale: u32, ) -> Option<(Self, u32)>

Implementors§