impl From<Vector<T>> for Vec<T>
MODIFY
src/manual/core/vector.rs
src/manual/core/vector.rs
@@ -84,6 +84,12 @@ impl<T: VectorElement> OpenCVTypeExternContainer for Vector<T> where Self: Vecto
}
}
+impl<'a, T: VectorElement> From<Vector<T>> for Vec<T> where Vector<T>: VectorExtern<T> {
+ fn from(from: Vector<T>) -> Self {
+ from.to_vec()
+ }
+}
+
impl<T: VectorElement> Vector<T> where Self: VectorExtern<T> {
/// Create a new Vector
pub fn new() -> Self {

MODIFY
tests/vector.rs
tests/vector.rs
@@ -436,10 +436,12 @@ fn to_vec() -> Result<()> {
{
let vec: VectorOfu8 = VectorOfu8::from_iter(vec![1, 2, 3, 4, 5]);
assert_eq!(vec.to_vec(), vec![1, 2, 3, 4, 5]);
+ assert_eq!(Vec::from(vec), vec![1, 2, 3, 4, 5]);
}
{
let vec = VectorOfVec4i::new();
assert_eq!(vec.to_vec(), Vec::new());
+ assert_eq!(Vec::from(vec), Vec::new());
}
{
let mut vec = VectorOfMat::new();

impl From<Vector<T>> for Vec<T>