diff --git a/CHANGES.md b/CHANGES.md index 403a0b80..14cf5c9d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,6 @@ +* 0.93.4 + * Various documentation, callback handling and other internal improvements. + * 0.93.3 * Fix issue with using `Option`, now behaves as expected and doesn't segfault. * Introduce `Mat::get_data_dump()` to get the dump of the Mat data, it's also included in the `Debug` output. diff --git a/docs/core.rs b/docs/core.rs index c8bc824e..19d243e8 100644 --- a/docs/core.rs +++ b/docs/core.rs @@ -33694,8 +33694,8 @@ pub mod core { /// serialized. #[inline] fn enqueue_host_callback(&mut self, callback: core::Stream_StreamCallback) -> Result<()> { - callback_arg!(callback_trampoline(status: i32, user_data: *mut c_void) -> () => user_data in callbacks => callback(status: i32) -> ()); - userdata_arg!(user_data in callbacks => callback); + callback_arg!(callback_trampoline(status: i32, user_data: *mut c_void) -> () => user_data in callback(status: i32) -> ()); + userdata_arg!(user_data: *mut c_void => callback); return_send!(via ocvrs_return); unsafe { sys::cv_cuda_Stream_enqueueHostCallback_StreamCallback_voidX(self.as_raw_mut_Stream(), callback_trampoline, user_data, ocvrs_return.as_mut_ptr()) }; return_receive!(unsafe ocvrs_return => ret); diff --git a/docs/face.rs b/docs/face.rs index 15d08ecd..6444749a 100644 --- a/docs/face.rs +++ b/docs/face.rs @@ -2817,8 +2817,8 @@ pub mod face { /// set the custom face detector #[inline] fn set_face_detector(&mut self, f: Option bool + Send + Sync + 'static>>) -> Result { - callback_arg!(f_trampoline(unnamed: *const c_void, unnamed_1: *const c_void, unnamed_2: *mut c_void) -> bool => unnamed_2 in callbacks => f(unnamed: *const c_void, unnamed_1: *const c_void) -> bool); - userdata_arg!(user_data in callbacks => f); + callback_arg!(f_trampoline(unnamed: *const c_void, unnamed_1: *const c_void, unnamed_2: *mut c_void) -> bool => unnamed_2 in f(unnamed: *const c_void, unnamed_1: *const c_void) -> bool); + userdata_arg!(user_data: *mut c_void => f); return_send!(via ocvrs_return); unsafe { sys::cv_face_FacemarkKazemi_setFaceDetector_bool__X__const_cv__InputArrayR__const_cv__OutputArrayR__voidX__voidX(self.as_raw_mut_FacemarkKazemi(), f_trampoline, user_data, ocvrs_return.as_mut_ptr()) }; return_receive!(unsafe ocvrs_return => ret); @@ -3669,8 +3669,8 @@ pub mod face { /// * user_data: 0 #[inline] fn set_face_detector(&mut self, detector: crate::face::FN_FaceDetector) -> Result { - callback_arg!(detector_trampoline(unnamed: *const c_void, unnamed_1: *const c_void, user_data: *mut c_void) -> bool => user_data in callbacks => detector(unnamed: *const c_void, unnamed_1: *const c_void) -> bool); - userdata_arg!(user_data in callbacks => detector); + callback_arg!(detector_trampoline(unnamed: *const c_void, unnamed_1: *const c_void, user_data: *mut c_void) -> bool => user_data in detector(unnamed: *const c_void, unnamed_1: *const c_void) -> bool); + userdata_arg!(user_data: *mut c_void => detector); return_send!(via ocvrs_return); unsafe { sys::cv_face_FacemarkTrain_setFaceDetector_FN_FaceDetector_voidX(self.as_raw_mut_FacemarkTrain(), detector_trampoline, user_data, ocvrs_return.as_mut_ptr()) }; return_receive!(unsafe ocvrs_return => ret); diff --git a/docs/highgui.rs b/docs/highgui.rs index 01e8515d..f87839da 100644 --- a/docs/highgui.rs +++ b/docs/highgui.rs @@ -580,8 +580,8 @@ pub mod highgui { #[inline] pub fn create_button_def(bar_name: &str, on_change: crate::highgui::ButtonCallback) -> Result { extern_container_arg!(bar_name); - callback_arg!(on_change_trampoline(state: i32, userdata: *mut c_void) -> () => userdata in callbacks => on_change(state: i32) -> ()); - userdata_arg!(userdata in callbacks => on_change); + callback_arg!(on_change_trampoline(state: i32, userdata: *mut c_void) -> () => userdata in on_change(state: i32) -> ()); + userdata_arg!(userdata: *mut c_void => on_change); return_send!(via ocvrs_return); unsafe { sys::cv_createButton_const_StringR_ButtonCallback_voidX(bar_name.opencv_as_extern(), on_change_trampoline, userdata, ocvrs_return.as_mut_ptr()) }; return_receive!(unsafe ocvrs_return => ret); @@ -624,8 +624,8 @@ pub mod highgui { #[inline] pub fn create_button(bar_name: &str, on_change: crate::highgui::ButtonCallback, typ: i32, initial_button_state: bool) -> Result { extern_container_arg!(bar_name); - callback_arg!(on_change_trampoline(state: i32, userdata: *mut c_void) -> () => userdata in callbacks => on_change(state: i32) -> ()); - userdata_arg!(userdata in callbacks => on_change); + callback_arg!(on_change_trampoline(state: i32, userdata: *mut c_void) -> () => userdata in on_change(state: i32) -> ()); + userdata_arg!(userdata: *mut c_void => on_change); return_send!(via ocvrs_return); unsafe { sys::cv_createButton_const_StringR_ButtonCallback_voidX_int_bool(bar_name.opencv_as_extern(), on_change_trampoline, userdata, typ, initial_button_state, ocvrs_return.as_mut_ptr()) }; return_receive!(unsafe ocvrs_return => ret); @@ -666,8 +666,8 @@ pub mod highgui { pub fn create_trackbar(trackbarname: &str, winname: &str, value: Option<&mut i32>, count: i32, on_change: crate::highgui::TrackbarCallback) -> Result { extern_container_arg!(trackbarname); extern_container_arg!(winname); - callback_arg!(on_change_trampoline(pos: i32, userdata: *mut c_void) -> () => userdata in callbacks => on_change(pos: i32) -> ()); - userdata_arg!(userdata in callbacks => on_change); + callback_arg!(on_change_trampoline(pos: i32, userdata: *mut c_void) -> () => userdata in on_change(pos: i32) -> ()); + userdata_arg!(userdata: *mut c_void => on_change); return_send!(via ocvrs_return); unsafe { sys::cv_createTrackbar_const_StringR_const_StringR_intX_int_TrackbarCallback_voidX(trackbarname.opencv_as_extern(), winname.opencv_as_extern(), value.map_or(::core::ptr::null_mut(), |value| value), count, on_change_trampoline, userdata, ocvrs_return.as_mut_ptr()) }; return_receive!(unsafe ocvrs_return => ret); @@ -1447,8 +1447,8 @@ pub mod highgui { #[inline] pub fn set_mouse_callback(winname: &str, on_mouse: crate::highgui::MouseCallback) -> Result<()> { extern_container_arg!(winname); - callback_arg!(on_mouse_trampoline(event: i32, x: i32, y: i32, flags: i32, userdata: *mut c_void) -> () => userdata in callbacks => on_mouse(event: i32, x: i32, y: i32, flags: i32) -> ()); - userdata_arg!(userdata in callbacks => on_mouse); + callback_arg!(on_mouse_trampoline(event: i32, x: i32, y: i32, flags: i32, userdata: *mut c_void) -> () => userdata in on_mouse(event: i32, x: i32, y: i32, flags: i32) -> ()); + userdata_arg!(userdata: *mut c_void => on_mouse); return_send!(via ocvrs_return); unsafe { sys::cv_setMouseCallback_const_StringR_MouseCallback_voidX(winname.opencv_as_extern(), on_mouse_trampoline, userdata, ocvrs_return.as_mut_ptr()) }; return_receive!(unsafe ocvrs_return => ret); @@ -1517,8 +1517,8 @@ pub mod highgui { #[inline] pub fn set_opengl_draw_callback(winname: &str, on_opengl_draw: crate::highgui::OpenGlDrawCallback) -> Result<()> { extern_container_arg!(winname); - callback_arg!(on_opengl_draw_trampoline(userdata: *mut c_void) -> () => userdata in callbacks => on_opengl_draw() -> ()); - userdata_arg!(userdata in callbacks => on_opengl_draw); + callback_arg!(on_opengl_draw_trampoline(userdata: *mut c_void) -> () => userdata in on_opengl_draw() -> ()); + userdata_arg!(userdata: *mut c_void => on_opengl_draw); return_send!(via ocvrs_return); unsafe { sys::cv_setOpenGlDrawCallback_const_StringR_OpenGlDrawCallback_voidX(winname.opencv_as_extern(), on_opengl_draw_trampoline, userdata, ocvrs_return.as_mut_ptr()) }; return_receive!(unsafe ocvrs_return => ret); diff --git a/docs/hub.rs b/docs/hub.rs index 1c03289d..fce60cf7 100644 --- a/docs/hub.rs +++ b/docs/hub.rs @@ -270,6 +270,6 @@ pub mod hub_prelude { mod ffi_exports { use crate::mod_prelude_sys::*; - #[no_mangle] unsafe extern "C" fn ocvrs_create_string_0_93_2(s: *const c_char) -> *mut String { crate::templ::ocvrs_create_string(s) } - #[no_mangle] unsafe extern "C" fn ocvrs_create_byte_string_0_93_2(v: *const u8, len: size_t) -> *mut Vec { crate::templ::ocvrs_create_byte_string(v, len) } + #[no_mangle] unsafe extern "C" fn ocvrs_create_string_0_93_3(s: *const c_char) -> *mut String { crate::templ::ocvrs_create_string(s) } + #[no_mangle] unsafe extern "C" fn ocvrs_create_byte_string_0_93_3(v: *const u8, len: size_t) -> *mut Vec { crate::templ::ocvrs_create_byte_string(v, len) } } diff --git a/docs/viz.rs b/docs/viz.rs index d42e791c..3e7a683a 100644 --- a/docs/viz.rs +++ b/docs/viz.rs @@ -2423,8 +2423,8 @@ pub mod viz { /// * cookie: 0 #[inline] fn register_keyboard_callback(&mut self, callback: crate::viz::Viz3d_KeyboardCallback) -> Result<()> { - callback_arg!(callback_trampoline(unnamed: *const c_void, unnamed_1: *mut c_void) -> () => unnamed_1 in callbacks => callback(unnamed: *const c_void) -> ()); - userdata_arg!(cookie in callbacks => callback); + callback_arg!(callback_trampoline(unnamed: *const c_void, unnamed_1: *mut c_void) -> () => unnamed_1 in callback(unnamed: *const c_void) -> ()); + userdata_arg!(cookie: *mut c_void => callback); return_send!(via ocvrs_return); unsafe { sys::cv_viz_Viz3d_registerKeyboardCallback_KeyboardCallback_voidX(self.as_raw_mut_Viz3d(), callback_trampoline, cookie, ocvrs_return.as_mut_ptr()) }; return_receive!(unsafe ocvrs_return => ret); @@ -2442,8 +2442,8 @@ pub mod viz { /// * cookie: 0 #[inline] fn register_mouse_callback(&mut self, callback: crate::viz::Viz3d_MouseCallback) -> Result<()> { - callback_arg!(callback_trampoline(unnamed: *const c_void, unnamed_1: *mut c_void) -> () => unnamed_1 in callbacks => callback(unnamed: *const c_void) -> ()); - userdata_arg!(cookie in callbacks => callback); + callback_arg!(callback_trampoline(unnamed: *const c_void, unnamed_1: *mut c_void) -> () => unnamed_1 in callback(unnamed: *const c_void) -> ()); + userdata_arg!(cookie: *mut c_void => callback); return_send!(via ocvrs_return); unsafe { sys::cv_viz_Viz3d_registerMouseCallback_MouseCallback_voidX(self.as_raw_mut_Viz3d(), callback_trampoline, cookie, ocvrs_return.as_mut_ptr()) }; return_receive!(unsafe ocvrs_return => ret);