Make sure that Vector is Send + Sync for T: Send + Sync
MODIFY
binding-generator/src/writer/rust_native/tpl/vector/rust.tpl.rs
binding-generator/src/writer/rust_native/tpl/vector/rust.tpl.rs
@@ -9,8 +9,6 @@ vector_extern! { {{inner_rust_full}}, {{rust_extern_const}}, {{rust_extern_mut}}
cv_{{rust_localalias}}_push, cv_{{rust_localalias}}_insert,
}
{{additional_methods}}
-
-unsafe impl Send for {{rust_full}} {}
{{impls}}

MODIFY
src/manual/core/vector.rs
src/manual/core/vector.rs
@@ -265,6 +265,10 @@ impl<T: VectorElement> Drop for Vector<T> where Self: VectorExtern<T> {
}
}
+unsafe impl<T: Send + VectorElement> Send for Vector<T> where Self: VectorExtern<T> {}
+
+unsafe impl<T: Sync + VectorElement> Sync for Vector<T> where Self: VectorExtern<T> {}
+
impl<'a, T: VectorElement> Extend<<T as OpenCVType<'a>>::Arg> for Vector<T> where Self: VectorExtern<T> {
fn extend<I: IntoIterator<Item=<T as OpenCVType<'a>>::Arg>>(&mut self, s: I) {
let s = s.into_iter();

MODIFY
tests/vector.rs
tests/vector.rs
@@ -708,3 +708,23 @@ fn from_slice() -> Result<()> {
Ok(())
}
+
+#[test]
+fn send() {
+ fn must_be_send<T: Send>(_: T) {}
+
+ must_be_send(VectorOfi32::new());
+ must_be_send(VectorOfMat::new());
+ must_be_send(VectorOfString::new());
+ must_be_send(VectorOfPoint2d::new());
+}
+
+#[test]
+fn sync() {
+ fn must_be_sync<T: Sync>(_: T) {}
+
+ must_be_sync(VectorOfi32::new());
+ must_be_sync(VectorOfString::new());
+ must_be_sync(VectorOfPoint2d::new());
+}
+

Make sure that Vector is Send + Sync for T: Send + Sync