@@ -119,6 +119,25 @@ impl From<u32> for ColorMap {
119119 }
120120}
121121
122+ mod private {
123+ pub trait Sealed { }
124+
125+ impl Sealed for num:: complex:: Complex < f32 > { }
126+ impl Sealed for num:: complex:: Complex < f64 > { }
127+ impl Sealed for f32 { }
128+ impl Sealed for f64 { }
129+ impl Sealed for bool { }
130+ impl Sealed for u8 { }
131+ impl Sealed for i16 { }
132+ impl Sealed for u16 { }
133+ impl Sealed for half:: f16 { }
134+ impl Sealed for i32 { }
135+ impl Sealed for u32 { }
136+ impl Sealed for i64 { }
137+ impl Sealed for u64 { }
138+ impl Sealed for usize { }
139+ }
140+
122141/// Types of the data that can be generated using ArrayFire data generation functions.
123142///
124143/// The trait HasAfEnum has been defined internally for the following types. We strongly suggest
@@ -139,7 +158,7 @@ impl From<u32> for ColorMap {
139158/// - i16
140159/// - u16
141160///
142- pub trait HasAfEnum {
161+ pub trait HasAfEnum : private :: Sealed {
143162 /// This type alias points to `Self` always.
144163 type InType : HasAfEnum ;
145164 /// This type alias points to the data type used to hold real part of a
@@ -795,7 +814,7 @@ impl BitOr for MatProp {
795814/// Trait to convert reduction's scalar output to appropriate output type
796815///
797816/// This is an internal trait and ideally of no use to user usecases.
798- pub trait Fromf64 {
817+ pub trait Fromf64 : private :: Sealed {
799818 /// Convert to target type from a double precision value
800819 fn fromf64 ( value : f64 ) -> Self ;
801820}
@@ -837,7 +856,7 @@ impl IndexableType for u16 {}
837856impl IndexableType for u8 { }
838857
839858/// Trait qualifier for given type indicating computability of covariance
840- pub trait IntegralType { }
859+ pub trait IntegralType : HasAfEnum { }
841860
842861impl IntegralType for i64 { }
843862impl IntegralType for u64 { }
0 commit comments