From 7cb8dcb4472e1e3ac77fb63fc3386c4e15b65bb7 Mon Sep 17 00:00:00 2001 From: Pro Date: Sun, 14 Jul 2024 15:57:22 +0200 Subject: [PATCH] Cleanup --- README.md | 2 +- build/library.rs | 4 ++-- src/boxed_ref.rs | 1 - src/manual/core/inplace.rs | 7 ++++--- tests/marshalling_only_latest_opencv.rs | 1 + tools/generate-bindings.sh | 1 - 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 5c1d0687..e22ff3e7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Documentation](https://docs.rs/opencv/badge.svg)](https://docs.rs/opencv) [![Package](https://img.shields.io/crates/v/opencv.svg)](https://crates.io/crates/opencv) -Experimental Rust bindings for OpenCV 3 and 4. +Rust bindings for the popular [OpenCV](https://opencv.org/) computer vision library. The API is usable, but unstable and not very battle-tested; use at your own risk. diff --git a/build/library.rs b/build/library.rs index 7480c502..6f3eb3c1 100644 --- a/build/library.rs +++ b/build/library.rs @@ -226,7 +226,7 @@ impl Library { let mut cargo_metadata = Vec::with_capacity(64); let include_paths: Vec<_> = include_paths.iter().map(PathBuf::from).collect(); - let version = Self::version_from_include_paths(&include_paths).ok_or("could not get versions from header files")?; + let version = Self::version_from_include_paths(&include_paths).ok_or("Could not OpenCV version from include_paths")?; cargo_metadata.extend(Self::process_link_paths(Some(link_paths), vec![], None)); cargo_metadata.extend(Self::process_link_libs(Some(link_libs), vec![], None)); @@ -425,7 +425,7 @@ impl Library { || env::var_os("OPENCV_CMAKE_BIN").is_some(); let explicit_vcpkg = env::var_os("VCPKG_ROOT").is_some(); eprintln!( - "=== Detected probe priority based on environment vars: pkg_config: {explicit_pkg_config}, cmake: {explicit_cmake}, vcpkg: {explicit_vcpkg}" + "=== Detected probe priority boost based on environment vars: pkg_config: {explicit_pkg_config}, cmake: {explicit_cmake}, vcpkg: {explicit_vcpkg}" ); let disabled_probes = env::var("OPENCV_DISABLE_PROBES"); diff --git a/src/boxed_ref.rs b/src/boxed_ref.rs index cde67ed5..0778f6d8 100644 --- a/src/boxed_ref.rs +++ b/src/boxed_ref.rs @@ -11,7 +11,6 @@ use crate::traits::{Boxed, OpenCVFromExtern, OpenCVIntoExternContainer, OpenCVTy #[repr(transparent)] pub struct BoxedRef<'r, T: Boxed> { pub(crate) reference: T, - // can make it &'r T, but then it will just take up unnecessary space referenced_object: PhantomData<&'r T>, } diff --git a/src/manual/core/inplace.rs b/src/manual/core/inplace.rs index 687c9391..932017b7 100644 --- a/src/manual/core/inplace.rs +++ b/src/manual/core/inplace.rs @@ -4,8 +4,9 @@ use crate::traits::Boxed; pub trait ModifyInplace { /// Helper function to call OpenCV functions that allow in-place modification of a `Mat` or another similar object. By passing /// a mutable reference to the `Mat` to this function your closure will get called with the read reference and a write references - /// to the same `Mat`. This is of course unsafe as it breaks the Rust aliasing rules, but it might be useful for some performance - /// sensitive operations. One example of an OpenCV function that allows such in-place modification is `imgproc::threshold`. + /// to the same `Mat`. This is unsafe in a general case as it leads to having non-exclusive mutable access to the internal data, + /// but it can be useful for some performance sensitive operations. One example of an OpenCV function that allows such in-place + /// modification is `imgproc::threshold`. /// /// # Safety /// Caller must make sure that any functions called inside the closure can act on a `Mat` in-place. @@ -23,7 +24,7 @@ impl ModifyInplace for Mat { } } -impl<'b, Mat: Boxed> ModifyInplace for BoxedRefMut<'b, Mat> { +impl ModifyInplace for BoxedRefMut<'_, Mat> { #[inline(always)] unsafe fn modify_inplace(&mut self, f: impl FnOnce(&Self, &mut Self) -> Res) -> Res { let mut m_alias = BoxedRefMut::from(Mat::from_raw(self.reference.as_raw_mut())); diff --git a/tests/marshalling_only_latest_opencv.rs b/tests/marshalling_only_latest_opencv.rs index 10a53bdc..a6bc190f 100644 --- a/tests/marshalling_only_latest_opencv.rs +++ b/tests/marshalling_only_latest_opencv.rs @@ -3,6 +3,7 @@ /// Setting and getting fields through Ptr #[test] #[cfg(all(ocvrs_has_module_aruco, any(ocvrs_opencv_branch_34, ocvrs_opencv_branch_4)))] +#[allow(deprecated)] fn field_access_on_ptr() -> opencv::Result<()> { use opencv::aruco::EstimateParameters; use opencv::prelude::*; diff --git a/tools/generate-bindings.sh b/tools/generate-bindings.sh index c3027396..183b84bc 100755 --- a/tools/generate-bindings.sh +++ b/tools/generate-bindings.sh @@ -110,7 +110,6 @@ all_modules_34="aruco ml objdetect optflow - ovis phase_unwrapping photo plot