Skip to content

Commit 01987e0

Browse files
committed
Merge pull request #69 from arrayfire/hotfix/enum_traits
add clone and partialeq to all enums
2 parents f22a5fb + e403475 commit 01987e0

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/defines.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::fmt::Error as FmtError;
44

55
/// Error codes
66
#[repr(C)]
7-
#[derive(Clone, Copy, Debug)]
7+
#[derive(Clone, Copy, Debug, PartialEq)]
88
pub enum AfError {
99
/// The function returned successfully
1010
SUCCESS = 0,
@@ -106,7 +106,7 @@ impl Error for AfError {
106106
}
107107

108108
/// Types of Array data type
109-
#[derive(Copy, Clone)]
109+
#[derive(Clone, Copy, Debug, PartialEq)]
110110
pub enum Aftype {
111111
/// 32 bit float
112112
F32 = 0,
@@ -135,7 +135,7 @@ pub enum Aftype {
135135
}
136136

137137
/// Dictates the interpolation method to be used by a function
138-
#[derive(Copy, Clone)]
138+
#[derive(Clone, Copy, Debug, PartialEq)]
139139
pub enum InterpType {
140140
/// Nearest Neighbor interpolation method
141141
NEAREST = 0,
@@ -148,7 +148,7 @@ pub enum InterpType {
148148
}
149149

150150
/// Helps determine how to pad kernels along borders
151-
#[derive(Copy, Clone)]
151+
#[derive(Clone, Copy, Debug, PartialEq)]
152152
pub enum BorderType {
153153
/// Pad using zeros
154154
ZERO = 0,
@@ -157,7 +157,7 @@ pub enum BorderType {
157157
}
158158

159159
/// Used by `regions` function to identify type of connectivity
160-
#[derive(Copy, Clone)]
160+
#[derive(Clone, Copy, Debug, PartialEq)]
161161
pub enum Connectivity {
162162
/// North-East-South-West (N-E-S-W) connectivity from given pixel/point
163163
FOUR = 4,
@@ -166,7 +166,7 @@ pub enum Connectivity {
166166
}
167167

168168
/// Helps determine the size of output of convolution
169-
#[derive(Copy, Clone)]
169+
#[derive(Clone, Copy, Debug, PartialEq)]
170170
pub enum ConvMode {
171171
/// Default convolution mode where output size is same as input size
172172
DEFAULT = 0,
@@ -175,7 +175,7 @@ pub enum ConvMode {
175175
}
176176

177177
/// Helps determine if convolution is in Spatial or Frequency domain
178-
#[derive(Copy, Clone)]
178+
#[derive(Clone, Copy, Debug, PartialEq)]
179179
pub enum ConvDomain {
180180
/// ArrayFire chooses whether the convolution will be in spatial domain or frequency domain
181181
AUTO = 0,
@@ -186,7 +186,7 @@ pub enum ConvDomain {
186186
}
187187

188188
/// Error metric used by `matchTemplate` function
189-
#[derive(Copy, Clone)]
189+
#[derive(Clone, Copy, Debug, PartialEq)]
190190
pub enum MatchType {
191191
/// Sum of Absolute Differences
192192
SAD = 0,
@@ -209,7 +209,7 @@ pub enum MatchType {
209209
}
210210

211211
/// Identify the color space of given image(Array)
212-
#[derive(Copy, Clone)]
212+
#[derive(Clone, Copy, Debug, PartialEq)]
213213
pub enum ColorSpace {
214214
/// Grayscale color space
215215
GRAY = 0,
@@ -220,7 +220,7 @@ pub enum ColorSpace {
220220
}
221221

222222
/// Helps determine the type of a Matrix
223-
#[derive(Copy, Clone)]
223+
#[derive(Clone, Copy, Debug, PartialEq)]
224224
pub enum MatProp {
225225
/// Default (no-op)
226226
NONE,
@@ -248,7 +248,7 @@ pub enum MatProp {
248248

249249
/// Norm type
250250
#[allow(non_camel_case_types)]
251-
#[derive(Copy, Clone)]
251+
#[derive(Clone, Copy, Debug, PartialEq)]
252252
pub enum NormType {
253253
/// Treats input as a vector and return sum of absolute values
254254
VECTOR_1 = 0,
@@ -270,7 +270,7 @@ pub enum NormType {
270270

271271
/// Dictates what color map is used for Image rendering
272272
#[repr(C)]
273-
#[derive(Copy, Clone)]
273+
#[derive(Clone, Copy, Debug, PartialEq)]
274274
pub enum ColorMap {
275275
/// Default color map is grayscale range [0-1]
276276
DEFAULT = 0,
@@ -290,7 +290,7 @@ pub enum ColorMap {
290290

291291
/// YCbCr Standards
292292
#[repr(C)]
293-
#[derive(Copy, Clone)]
293+
#[derive(Clone, Copy, Debug, PartialEq)]
294294
pub enum YCCStd {
295295
/// ITU-R BT.601 (formerly CCIR 601) standard
296296
YCC_601 = 601,
@@ -302,7 +302,7 @@ pub enum YCCStd {
302302

303303
/// Homography type
304304
#[repr(C)]
305-
#[derive(Copy, Clone)]
305+
#[derive(Clone, Copy, Debug, PartialEq)]
306306
pub enum HomographyType {
307307
/// RANdom SAmple Consensus algorithm
308308
RANSAC = 0,
@@ -312,7 +312,7 @@ pub enum HomographyType {
312312

313313
/// Plotting markers
314314
#[repr(C)]
315-
#[derive(Copy, Clone)]
315+
#[derive(Clone, Copy, Debug, PartialEq)]
316316
pub enum MarkerType {
317317
NONE = 0,
318318
POINT = 1,

0 commit comments

Comments
 (0)