From b8799e7489d16b80448ea187438ea0be70727302 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Tue, 9 Jan 2024 08:10:08 -0700 Subject: [PATCH] Rename `ZeroConstant` => `ConstZero` Renames the trait to match the prospective name it might potentially receive upstream in `num-traits`: rust-num/num-traits#303 --- src/limb.rs | 4 ++-- src/modular/const_monty_form.rs | 4 ++-- src/traits.rs | 6 +++--- src/uint.rs | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/limb.rs b/src/limb.rs index f64d1e88..cbdf34b1 100644 --- a/src/limb.rs +++ b/src/limb.rs @@ -19,7 +19,7 @@ mod sub; #[cfg(feature = "rand_core")] mod rand; -use crate::{Bounded, ConstCtOption, Constants, NonZero, ZeroConstant}; +use crate::{Bounded, ConstCtOption, ConstZero, Constants, NonZero}; use core::fmt; use subtle::{Choice, ConditionallySelectable, ConstantTimeEq}; @@ -120,7 +120,7 @@ impl ConditionallySelectable for Limb { } } -impl ZeroConstant for Limb { +impl ConstZero for Limb { const ZERO: Self = Self::ZERO; } diff --git a/src/modular/const_monty_form.rs b/src/modular/const_monty_form.rs index a2bfa5f8..3e1f52e7 100644 --- a/src/modular/const_monty_form.rs +++ b/src/modular/const_monty_form.rs @@ -9,7 +9,7 @@ mod sub; use self::inv::ConstMontyFormInverter; use super::{div_by_2::div_by_2, reduction::montgomery_reduction, BernsteinYangInverter, Retrieve}; -use crate::{Limb, Odd, PrecomputeInverter, Uint, ZeroConstant}; +use crate::{ConstZero, Limb, Odd, PrecomputeInverter, Uint}; use core::{fmt::Debug, marker::PhantomData}; use subtle::{Choice, ConditionallySelectable, ConstantTimeEq}; @@ -181,7 +181,7 @@ impl, const LIMBS: usize> Default for ConstMontyFor } } -impl, const LIMBS: usize> ZeroConstant for ConstMontyForm { +impl, const LIMBS: usize> ConstZero for ConstMontyForm { const ZERO: Self = Self::ZERO; } diff --git a/src/traits.rs b/src/traits.rs index 410f3c68..2780226a 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -267,12 +267,12 @@ pub trait Zero: ConstantTimeEq + Sized { /// Trait for associating a constant representing zero. /// /// Types which impl this trait automatically receive a blanket impl of [`Zero`]. -pub trait ZeroConstant: Zero { +pub trait ConstZero: Zero { /// The value `0`. const ZERO: Self; } -impl Zero for T { +impl Zero for T { #[inline(always)] fn zero() -> T { Self::ZERO @@ -280,7 +280,7 @@ impl Zero for T { } /// Trait for associating constant values with a type. -pub trait Constants: ZeroConstant { +pub trait Constants: ConstZero { /// The value `1`. const ONE: Self; diff --git a/src/uint.rs b/src/uint.rs index ee6d3fc1..a150c2ae 100644 --- a/src/uint.rs +++ b/src/uint.rs @@ -41,8 +41,8 @@ mod rand; use crate::{ modular::{BernsteinYangInverter, MontyForm}, - Bounded, ConstCtOption, Constants, Encoding, FixedInteger, Integer, Limb, NonZero, Odd, - PrecomputeInverter, PrecomputeInverterWithAdjuster, Word, ZeroConstant, + Bounded, ConstCtOption, ConstZero, Constants, Encoding, FixedInteger, Integer, Limb, NonZero, + Odd, PrecomputeInverter, PrecomputeInverterWithAdjuster, Word, }; use core::fmt; use subtle::{Choice, ConditionallySelectable, ConstantTimeEq}; @@ -258,7 +258,7 @@ impl Integer for Uint { } } -impl ZeroConstant for Uint { +impl ConstZero for Uint { const ZERO: Self = Self::ZERO; }