From bc42b83117155c84625837ea336691ca119a5b0c Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Sat, 30 Dec 2023 14:56:39 -0700 Subject: [PATCH] Rename to ConstZero/ConstOne and re-export from toplevel --- src/identities.rs | 12 ++++++------ src/lib.rs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/identities.rs b/src/identities.rs index ff8bf2ea..bc6c56a2 100644 --- a/src/identities.rs +++ b/src/identities.rs @@ -33,7 +33,7 @@ pub trait Zero: Sized + Add { /// /// Types which impl both this trait and [`PartialEq`] will receive a blanket /// impl of the [`Zero`] trait. -pub trait ZeroConstant: Zero { +pub trait ConstZero: Zero { /// The additive identity element of `Self`, `0`. const ZERO: Self; } @@ -51,7 +51,7 @@ macro_rules! zero_impl { } } - impl ZeroConstant for $t { + impl ConstZero for $t { const ZERO: Self = $v; } }; @@ -91,7 +91,7 @@ where } } -impl ZeroConstant for Wrapping +impl ConstZero for Wrapping where Wrapping: Add>, { @@ -141,7 +141,7 @@ pub trait One: Sized + Mul { /// /// Types which impl both this trait and [`PartialEq`] will receive a blanket /// impl of the [`One`] trait. -pub trait OneConstant: One { +pub trait ConstOne: One { /// The multiplicative identity element of `Self`, `1`. const ONE: Self; } @@ -159,7 +159,7 @@ macro_rules! one_impl { } } - impl OneConstant for $t { + impl ConstOne for $t { const ONE: Self = $v; } }; @@ -195,7 +195,7 @@ where } } -impl OneConstant for Wrapping +impl ConstOne for Wrapping where Wrapping: Mul>, { diff --git a/src/lib.rs b/src/lib.rs index 54dab6e5..9ee16fc8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,7 +33,7 @@ pub use crate::float::Float; pub use crate::float::FloatConst; // pub use real::{FloatCore, Real}; // NOTE: Don't do this, it breaks `use num_traits::*;`. pub use crate::cast::{cast, AsPrimitive, FromPrimitive, NumCast, ToPrimitive}; -pub use crate::identities::{one, zero, One, Zero}; +pub use crate::identities::{one, zero, ConstOne, ConstZero, One, Zero}; pub use crate::int::PrimInt; pub use crate::ops::bytes::{FromBytes, ToBytes}; pub use crate::ops::checked::{