NumWords

Trait NumWords 

Source
pub trait NumWords: Clone + Debug {
    type WordsFieldElement: ArrayLength + Debug;
    type WordsCurvePoint: ArrayLength + Debug;
}
Expand description

Trait that holds number of words needed to represent a field element and a curve point.

Required Associated Types§

Source

type WordsFieldElement: ArrayLength + Debug

The number of words needed to represent a field element.

Source

type WordsCurvePoint: ArrayLength + Debug

The number of words needed to represent a curve point (two field elements).

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<N: NumLimbs> NumWords for N
where N::Limbs: Div<U4> + Div<U2>, <N::Limbs as Div<U4>>::Output: ArrayLength + Debug, <N::Limbs as Div<U2>>::Output: ArrayLength + Debug,

Implement NumWords for NumLimbs where # Limbs is divisible by 4.

Using typenum we can do N/4 and N/2 in type-level arithmetic. Having it as a separate trait avoids needing the Div where clauses everywhere.