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 ZERO: Self;
    const ONE: Self;
    const TEN: Self;
    const HUNDRED: Self;
    const MAX_MATISSA: Self;
    const MIN_UNDERINT: Self;
    const BITS: u32;
    const MAX_SCALE: u32;
    const SCALE_BITS: u32 = _;
    const META_BITS: u32 = _;
    const MATISSA_BITS: 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(
        self,
        right: Self,
        sum_scale: u32,
    ) -> Option<(Self, u32)>;
    fn div_with_scales(
        self,
        d: Self,
        s_scale: u32,
        d_scale: u32,
    ) -> Option<(Self, u32)>;
}
Expand description

Underlying integer type.

Required Associated Constants§

Source

const ZERO: Self

Source

const ONE: Self

Source

const TEN: Self

Source

const HUNDRED: Self

Source

const MAX_MATISSA: Self

Source

const MIN_UNDERINT: Self

Source

const BITS: u32

Source

const MAX_SCALE: u32

Provided Associated Constants§

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(self, right: Self, sum_scale: u32) -> Option<(Self, u32)>

Source

fn div_with_scales( 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 u128

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TEN: Self = 10

Source§

const HUNDRED: Self = 100

Source§

const MAX_MATISSA: Self

Source§

const MIN_UNDERINT: Self

Source§

const BITS: u32 = 128

Source§

const MAX_SCALE: u32 = 36

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(self, right: Self, sum_scale: u32) -> Option<(Self, u32)>

Source§

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

Implementors§