Skip to main content

Integer

Trait Integer 

pub trait Integer:
    Sized
    + 'static
    + AsRef<[Limb]>
    + BitAnd<Output = Self>
    + BitOr<Output = Self>
    + BitXor<Output = Self>
    + for<'a> CheckedAdd<&'a Self, Output = Self>
    + for<'a> CheckedSub<&'a Self, Output = Self>
    + for<'a> CheckedMul<&'a Self, Output = Self>
    + Copy
    + ConditionallySelectable
    + ConstantTimeEq
    + ConstantTimeGreater
    + ConstantTimeLess
    + Debug
    + Default
    + Div<NonZero<Self>, Output = Self>
    + Eq
    + From<u64>
    + Not
    + Ord
    + Rem<NonZero<Self>, Output = Self>
    + Send
    + Shl<usize, Output = Self>
    + Shr<usize, Output = Self>
    + Sync
    + Zero {
    const ONE: Self;
    const MAX: Self;
    const BITS: usize;
    const BYTES: usize;
    const LIMBS: usize;

    // Required method
    fn is_odd(&self) -> Choice;

    // Provided method
    fn is_even(&self) -> Choice { ... }
}
Expand description

Integer type.

Required Associated Constants§

const ONE: Self

The value 1.

const MAX: Self

Maximum value this integer can express.

const BITS: usize

Total size of the represented integer in bits.

const BYTES: usize

Total size of the represented integer in bytes.

const LIMBS: usize

The number of limbs used on this platform.

Required Methods§

fn is_odd(&self) -> Choice

Is this integer value an odd number?

§Returns

If odd, returns Choice(1). Otherwise, returns Choice(0).

Provided Methods§

fn is_even(&self) -> Choice

Is this integer value an even number?

§Returns

If even, returns Choice(1). Otherwise, returns Choice(0).

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.

Implementors§

§

impl<const LIMBS: usize> Integer for Uint<LIMBS>

§

const ONE: Uint<LIMBS> = Self::ONE

§

const MAX: Uint<LIMBS> = Self::MAX

§

const BITS: usize = Self::BITS

§

const BYTES: usize = Self::BYTES

§

const LIMBS: usize = Self::LIMBS