Skip to main content

Integer

Trait Integer 

Source
pub trait Integer:
    'static
    + Add<Output = Self>
    + for<'a> Add<&'a Self, Output = Self>
    + AddAssign<Self>
    + for<'a> AddAssign<&'a Self>
    + AsRef<[Limb]>
    + AsMut<[Limb]>
    + BitAnd<Output = Self>
    + for<'a> BitAnd<&'a Self, Output = Self>
    + BitAndAssign
    + for<'a> BitAndAssign<&'a Self>
    + BitOr<Output = Self>
    + for<'a> BitOr<&'a Self, Output = Self>
    + BitOrAssign
    + for<'a> BitOrAssign<&'a Self>
    + BitXor<Output = Self>
    + for<'a> BitXor<&'a Self, Output = Self>
    + BitXorAssign
    + for<'a> BitXorAssign<&'a Self>
    + CheckedAdd
    + CheckedSub
    + CheckedMul
    + CheckedDiv
    + CheckedSquareRoot<Output = Self>
    + Clone
    + CtAssign
    + CtEq
    + CtGt
    + CtLt
    + CtSelect
    + Debug
    + Default
    + DivAssign<NonZero<Self>>
    + for<'a> DivAssign<&'a NonZero<Self>>
    + Eq
    + LowerHex
    + UpperHex
    + Binary
    + Mul<Output = Self>
    + for<'a> Mul<&'a Self, Output = Self>
    + MulAssign<Self>
    + for<'a> MulAssign<&'a Self>
    + Not<Output = Self>
    + One
    + Ord
    + Rem<NonZero<Self>, Output = Self>
    + for<'a> Rem<&'a NonZero<Self>, Output = Self>
    + RemAssign<NonZero<Self>>
    + for<'a> RemAssign<&'a NonZero<Self>>
    + Send
    + Sized
    + Shl<u32, Output = Self>
    + ShlAssign<u32>
    + ShlVartime
    + Shr<u32, Output = Self>
    + ShrAssign<u32>
    + ShrVartime
    + Sub<Output = Self>
    + for<'a> Sub<&'a Self, Output = Self>
    + SubAssign<Self>
    + for<'a> SubAssign<&'a Self>
    + Sync
    + WrappingAdd
    + WrappingSub
    + WrappingMul
    + WrappingNeg
    + WrappingShl
    + WrappingShr
    + Zero {
    // Required methods
    fn as_limbs(&self) -> &[Limb];
    fn as_mut_limbs(&mut self) -> &mut [Limb];
    fn nlimbs(&self) -> usize;

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

Integer trait: represents common functionality of integer types provided by this crate.

Required Methods§

Source

fn as_limbs(&self) -> &[Limb]

Borrow the raw limbs used to represent this integer.

Source

fn as_mut_limbs(&mut self) -> &mut [Limb]

Mutably borrow the raw limbs used to represent this integer.

Source

fn nlimbs(&self) -> usize

Number of limbs in this integer.

Provided Methods§

Source

fn is_odd(&self) -> Choice

Is this integer value an odd number?

§Returns

If odd, returns Choice::FALSE. Otherwise, returns Choice::TRUE.

Source

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§

Source§

impl Integer for BoxedUint

Available on crate feature alloc only.
Source§

impl Integer for Limb

Source§

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

Source§

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