@@ -119,6 +119,25 @@ impl From<u32> for ColorMap {
119
119
}
120
120
}
121
121
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
+
122
141
/// Types of the data that can be generated using ArrayFire data generation functions.
123
142
///
124
143
/// The trait HasAfEnum has been defined internally for the following types. We strongly suggest
@@ -139,7 +158,7 @@ impl From<u32> for ColorMap {
139
158
/// - i16
140
159
/// - u16
141
160
///
142
- pub trait HasAfEnum {
161
+ pub trait HasAfEnum : private :: Sealed {
143
162
/// This type alias points to `Self` always.
144
163
type InType : HasAfEnum ;
145
164
/// This type alias points to the data type used to hold real part of a
@@ -795,7 +814,7 @@ impl BitOr for MatProp {
795
814
/// Trait to convert reduction's scalar output to appropriate output type
796
815
///
797
816
/// This is an internal trait and ideally of no use to user usecases.
798
- pub trait Fromf64 {
817
+ pub trait Fromf64 : private :: Sealed {
799
818
/// Convert to target type from a double precision value
800
819
fn fromf64 ( value : f64 ) -> Self ;
801
820
}
@@ -837,7 +856,7 @@ impl IndexableType for u16 {}
837
856
impl IndexableType for u8 { }
838
857
839
858
/// Trait qualifier for given type indicating computability of covariance
840
- pub trait IntegralType { }
859
+ pub trait IntegralType : HasAfEnum { }
841
860
842
861
impl IntegralType for i64 { }
843
862
impl IntegralType for u64 { }
0 commit comments