move manual out of hub
MODIFY
build.rs
build.rs
@@ -88,7 +88,7 @@ fn build_wrapper(opencv_header_dir: &PathBuf) -> Result<(), Box<dyn Error>> {
let out_dir_as_str = out_dir.to_str().unwrap();
let hub_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?).join("src");
let module_dir = hub_dir.join("hub");
- let manual_dir = module_dir.join("manual");
+ let manual_dir = hub_dir.join("manual");
let opencv_dir = opencv_header_dir.join("opencv2");
@@ -289,9 +289,7 @@ fn build_wrapper(opencv_header_dir: &PathBuf) -> Result<(), Box<dyn Error>> {
let add_manual = |file: &mut File, mod_name: &str| -> Result<bool, Box<dyn Error>> {
if manual_dir.join(format!("{}.rs", mod_name)).exists() {
- writeln!(file, "pub use crate::hub::manual::{}::*;", mod_name)?;
- let mut m = OpenOptions::new().create(true).append(true).open(&module_dir.join("manual.rs"))?;
- writeln!(&mut m, "pub mod {};", mod_name)?;
+ writeln!(file, "pub use crate::manual::{}::*;", mod_name)?;
Ok(true)
} else {
Ok(false)
@@ -300,19 +298,13 @@ fn build_wrapper(opencv_header_dir: &PathBuf) -> Result<(), Box<dyn Error>> {
{
let mut hub = File::create(hub_dir.join("hub.rs"))?;
- let mut manual_writen = false;
for ref module in &modules {
writeln!(&mut hub, r#"pub mod {};"#, module.0)?;
let module_filename = format!("{}.rs", module.0);
let target_file = module_dir.join(&module_filename);
fs::rename(out_dir.join(&module_filename), &target_file)?;
let mut f = OpenOptions::new().append(true).open(&target_file)?;
- if let Ok(true) = add_manual(&mut f, &module.0) {
- if !manual_writen {
- writeln!(&mut hub, "mod manual;")?;
- manual_writen = true;
- }
- }
+ add_manual(&mut f, &module.0)?;
}
writeln!(&mut hub, "pub mod types;")?;
writeln!(&mut hub, "#[doc(hidden)] pub mod sys;")?;

MODIFY
src/lib.rs
src/lib.rs
@@ -15,6 +15,8 @@ mod templ;
#[allow(non_camel_case_types)]
mod hub;
+mod manual;
+
mod error;
pub mod prelude {

RENAME
src/hub/manual/core.rs
src/manual/core.rs
RENAME
src/hub/manual/core/mat.rs
src/manual/core/mat.rs
RENAME
src/hub/manual/core/point.rs
src/manual/core/point.rs
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
-use std::process::Output;
-use crate::hub::manual::core::size::ValidSizeType;
+use crate::manual::core::size::ValidSizeType;
valid_types!(ValidPointType, i32, i64, f32, f64);

RENAME
src/hub/manual/core/rect.rs
src/manual/core/rect.rs
RENAME
src/hub/manual/core/size.rs
src/manual/core/size.rs
RENAME
src/hub/manual/core/vec.rs
src/manual/core/vec.rs
RENAME
src/hub/manual/features2d.rs
src/manual/features2d.rs
RENAME
src/hub/manual.rs
src/manual/mod.rs
pub mod core;
pub mod features2d;
-pub mod types;
pub mod sys;
+pub mod types;

RENAME
src/hub/manual/sys.rs
src/manual/sys.rs
-use std::{
- ffi::CStr,
- os::raw::c_char,
-};
+use std::os::raw::c_char;
use std::marker::PhantomData;
use crate::{Error, Result};

RENAME
src/hub/manual/types.rs
src/manual/types.rs
move manual out of hub