1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
mod common; #[cfg(feature = "opencv")] mod with_opencv; #[cfg(all(feature = "opencv", feature = "nalgebra"))] mod with_opencv_nalgebra; #[cfg(all(feature = "tch", feature = "image"))] mod with_tch_image; pub use from::*; pub use try_from::*; #[cfg(feature = "opencv")] pub use with_opencv::*; #[cfg(all(feature = "opencv", feature = "nalgebra"))] pub use with_opencv_nalgebra::*; #[cfg(all(feature = "tch", feature = "image"))] pub use with_tch_image::*; mod try_from { pub trait TryFromCv<T> where Self: Sized, { type Error; fn try_from_cv(from: T) -> Result<Self, Self::Error>; } pub trait TryIntoCv<T> { type Error; fn try_into_cv(self) -> Result<T, Self::Error>; } impl<T, U> TryIntoCv<U> for T where U: TryFromCv<T>, { type Error = <U as TryFromCv<T>>::Error; fn try_into_cv(self) -> Result<U, Self::Error> { U::try_from_cv(self) } } } mod from { pub trait FromCv<T> { fn from_cv(from: T) -> Self; } pub trait IntoCv<T> { fn into_cv(self) -> T; } impl<T, U> IntoCv<U> for T where U: FromCv<T>, { fn into_cv(self) -> U { U::from_cv(self) } } }