pub trait ReduceNonZero<Uint: Integer>: Reduce<Uint> + Sized {
// Required methods
fn reduce_nonzero(n: Uint) -> Self;
fn reduce_nonzero_bytes(bytes: &Self::Bytes) -> Self;
}
Expand description
Modular reduction to a non-zero output.
This trait is primarily intended for use by curve implementations such
as the k256
and p256
crates.
End users should use the Reduce
impl on
NonZeroScalar
instead.
Required Methods§
Sourcefn reduce_nonzero(n: Uint) -> Self
fn reduce_nonzero(n: Uint) -> Self
Perform a modular reduction, returning a field element.
Sourcefn reduce_nonzero_bytes(bytes: &Self::Bytes) -> Self
fn reduce_nonzero_bytes(bytes: &Self::Bytes) -> Self
Interpret the given bytes as an integer and perform a modular reduction to a non-zero output.
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<C, I> ReduceNonZero<I> for NonZeroScalar<C>where
Self: Reduce<I>,
C: CurveArithmetic,
I: Integer + ArrayEncoding,
Scalar<C>: Reduce<I, Bytes = Self::Bytes> + ReduceNonZero<I>,
Note: forwards to the Reduce
impl.