@@ -30,7 +30,7 @@ use core::str::FromStr;
3030#[ cfg( feature = "std" ) ]
3131use std:: error:: Error ;
3232
33- use num_traits:: { Inv , MulAdd , Num , One , Pow , Signed , Zero } ;
33+ use num_traits:: { ConstOne , ConstZero , Inv , MulAdd , Num , One , Pow , Signed , Zero } ;
3434
3535use num_traits:: float:: FloatCore ;
3636#[ cfg( any( feature = "std" , feature = "libm" ) ) ]
@@ -1146,6 +1146,15 @@ impl<T: Clone + Num> Rem<T> for Complex<T> {
11461146real_arithmetic ! ( usize , u8 , u16 , u32 , u64 , u128 , isize , i8 , i16 , i32 , i64 , i128 , f32 , f64 ) ;
11471147
11481148// constants
1149+ impl < T : ConstZero > Complex < T > {
1150+ /// A constant `Complex` 0.
1151+ pub const ZERO : Self = Self :: new ( T :: ZERO , T :: ZERO ) ;
1152+ }
1153+
1154+ impl < T : Clone + Num + ConstZero > ConstZero for Complex < T > {
1155+ const ZERO : Self = Self :: ZERO ;
1156+ }
1157+
11491158impl < T : Clone + Num > Zero for Complex < T > {
11501159 #[ inline]
11511160 fn zero ( ) -> Self {
@@ -1164,6 +1173,15 @@ impl<T: Clone + Num> Zero for Complex<T> {
11641173 }
11651174}
11661175
1176+ impl < T : ConstOne + ConstZero > Complex < T > {
1177+ /// A constant `Complex` 1.
1178+ pub const ONE : Self = Self :: new ( T :: ONE , T :: ZERO ) ;
1179+ }
1180+
1181+ impl < T : Clone + Num + ConstOne + ConstZero > ConstOne for Complex < T > {
1182+ const ONE : Self = Self :: ONE ;
1183+ }
1184+
11671185impl < T : Clone + Num > One for Complex < T > {
11681186 #[ inline]
11691187 fn one ( ) -> Self {
0 commit comments