Add operator== support
MODIFY
binding-generator/src/func.rs
binding-generator/src/func.rs
@@ -40,6 +40,7 @@ pub enum OperatorKind {
Mul,
Div,
Deref,
+ Equals,
}
impl OperatorKind {
@@ -64,6 +65,9 @@ impl OperatorKind {
"/" => {
OperatorKind::Div
}
+ "==" => {
+ OperatorKind::Equals
+ }
_ => {
OperatorKind::Unsupported
},
@@ -690,6 +694,9 @@ impl Element for Func<'_, '_> {
"try_deref_mut".into()
}
}
+ OperatorKind::Equals => {
+ "equals".into()
+ }
}
} else {
cpp_name

MODIFY
binding-generator/src/settings.rs
binding-generator/src/settings.rs
@@ -255,6 +255,9 @@ pub static FUNC_RENAME: Lazy<HashMap<&str, &str>> = Lazy::new(|| hashmap! {
"cv_operatorD_const_MatR_double" => "+_mat_f64",
"cv_operatorD_double_const_MatExprR" => "+_f64_matexpr",
"cv_operatorD_double_const_MatR" => "+_f64_mat",
+ "cv_operatorEQ_const_FileNodeIteratorR_const_FileNodeIteratorR" => "+_filenode_iter",
+ "cv_operatorEQ_const_MatR_double" => "+_mat_f64",
+ "cv_operatorEQ_double_const_MatR" => "+_f64_mat",
"cv_operatorS_const_MatExprR" => "+_matexpr",
"cv_operatorS_const_MatExprR_const_MatExprR" => "+_matexpr_matexpr",
"cv_operatorS_const_MatExprR_const_MatR" => "+_matexpr_mat",

MODIFY
binding-generator/src/string_ext.rs
binding-generator/src/string_ext.rs
@@ -210,6 +210,7 @@ impl StringExt for String {
self.replace_in_place("+", "A");
self.replace_in_place("-", "S");
self.replace_in_place("/", "D");
+ self.replace_in_place("==", "EQ");
}
}

MODIFY
tests/mat.rs
tests/mat.rs
@@ -604,3 +604,15 @@ fn mat_data() -> Result<()> {
}
Ok(())
}
+
+#[test]
+fn mat_equals() -> Result<()> {
+ let mat1 = Mat::new_rows_cols_with_default(3, 3, i32::typ(), Scalar::all(0.))?;
+ let mat2 = Mat::new_rows_cols_with_default(3, 3, i32::typ(), Scalar::all(0.))?;
+ let mat3 = Mat::new_rows_cols_with_default(3, 3, i32::typ(), Scalar::all(1.))?;
+ let res = core::equals(&mat1, &mat2)?.to_mat()?;
+ assert!(res.data_typed::<u8>()?.iter().all(|&e| e != 0));
+ let res = core::equals(&mat1, &mat3)?.to_mat()?;
+ assert!(res.data_typed::<u8>()?.iter().all(|&e| e == 0));
+ Ok(())
+}

Add operator== support