Make sure that howToGetFeatures of createStructuredEdgeDetection() is nullable
MODIFY
binding-generator/src/settings.rs
binding-generator/src/settings.rs
@@ -1023,6 +1023,9 @@ pub static ARGUMENT_OVERRIDE: Lazy<HashMap<FuncId, HashMap<&str, ArgOverride>>>
"c3" => ArgOverride::Char8AsChar,
"c4" => ArgOverride::Char8AsChar,
},
+ FuncId::new("cv::ximgproc::createStructuredEdgeDetection", ["model", "howToGetFeatures"]) => hashmap! {
+ "howToGetFeatures" => ArgOverride::Nullable,
+ },
});
pub static NO_SKIP_NAMESPACE_IN_LOCALNAME: Lazy<HashMap<&str, HashMap<&str, &str>>> = Lazy::new(|| hashmap! {

MODIFY
binding-generator/src/type_ref.rs
binding-generator/src/type_ref.rs
@@ -1239,11 +1239,21 @@ impl<'tu, 'ge> TypeRef<'tu, 'ge> {
}
if self.is_by_ptr() {
let typ = self.source();
- return if constness.with(self.constness()).is_const() {
+ let by_ptr = if constness.with(self.constness()).is_const() {
format!("{name}.as_raw_{rust_safe_id}()", name=name, rust_safe_id=typ.rust_safe_id_ext(false))
} else {
format!("{name}.as_raw_mut_{rust_safe_id}()", name=name, rust_safe_id=typ.rust_safe_id_ext(false))
- }
+ };
+ return if self.is_nullable() {
+ format!(
+ "{name}.map_or({null_ptr}, |{name}| {by_ptr})",
+ name=name,
+ null_ptr=constness.with(self.constness()).rust_null_ptr_full(),
+ by_ptr=by_ptr
+ )
+ } else{
+ by_ptr
+ };
}
if self.as_variable_array().is_some() {
let arr = if constness.with(self.constness()).is_const() {

MODIFY
binding-generator/src/type_ref/renderer.rs
binding-generator/src/type_ref/renderer.rs
@@ -394,7 +394,8 @@ impl TypeRefRenderer<'_> for RustRenderer {
self.wrap_nullable(type_ref, typ.into())
}
Kind::SmartPtr(ptr) => {
- ptr.rust_name(self.name_style).into_owned().into()
+ let typ = ptr.rust_name(self.name_style).into_owned();
+ self.wrap_nullable(type_ref, typ.into())
}
Kind::Class(cls) => {
let fish_style = self.name_style.turbo_fish_style();

Make sure that howToGetFeatures of createStructuredEdgeDetection() is nullable