Trait Integer

Source
pub trait Integer:
    'static
    + Add<Output = Self>
    + for<'a> Add<&'a Self, Output = Self>
    + AddAssign<Self>
    + for<'a> AddAssign<&'a Self>
    + AddMod<Output = Self>
    + AsRef<[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>
    + BitOps
    + CheckedAdd
    + CheckedSub
    + CheckedMul
    + CheckedDiv
    + Clone
    + ConstantTimeEq
    + ConstantTimeGreater
    + ConstantTimeLess
    + ConstantTimeSelect
    + Debug
    + Default
    + Div<NonZero<Self>, Output = Self>
    + for<'a> Div<&'a NonZero<Self>, Output = Self>
    + DivAssign<NonZero<Self>>
    + for<'a> DivAssign<&'a NonZero<Self>>
    + DivRemLimb
    + Eq
    + From<u8>
    + From<u16>
    + From<u32>
    + From<u64>
    + From<Limb>
    + Mul<Output = Self>
    + for<'a> Mul<&'a Self, Output = Self>
    + MulAssign<Self>
    + for<'a> MulAssign<&'a Self>
    + MulMod<Output = Self>
    + NegMod<Output = Self>
    + Not<Output = Self>
    + Ord
    + Rem<NonZero<Self>, Output = Self>
    + for<'a> Rem<&'a NonZero<Self>, Output = Self>
    + RemAssign<NonZero<Self>>
    + for<'a> RemAssign<&'a NonZero<Self>>
    + RemLimb
    + 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>
    + SubMod<Output = Self>
    + Sync
    + SquareRoot
    + WrappingAdd
    + WrappingSub
    + WrappingMul
    + WrappingNeg
    + WrappingShl
    + WrappingShr
    + Zero {
    type Monty: Monty<Integer = Self>;

    // Required methods
    fn one() -> Self;
    fn from_limb_like(limb: Limb, other: &Self) -> Self;
    fn nlimbs(&self) -> usize;

    // Provided methods
    fn one_like(other: &Self) -> Self { ... }
    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 Associated Types§

Source

type Monty: Monty<Integer = Self>

The corresponding Montgomery representation, optimized for the performance of modular operations at the price of a conversion overhead.

Required Methods§

Source

fn one() -> Self

The value 1.

Source

fn from_limb_like(limb: Limb, other: &Self) -> Self

Returns an integer with the first limb set to limb, and the same precision as other.

Source

fn nlimbs(&self) -> usize

Number of limbs in this integer.

Provided Methods§

Source

fn one_like(other: &Self) -> Self

The value 1 with the same precision as other.

Source

fn is_odd(&self) -> Choice

Is this integer value an odd number?

§Returns

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

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<const LIMBS: usize> Integer for Uint<LIMBS>

Source§

type Monty = MontyForm<LIMBS>