diff --git a/src/configuration.rs b/src/configuration.rs index 1bd1c9f..c1289de 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -29,6 +29,8 @@ mod json { pub rust: Rust, #[serde(default = "false_bool")] pub overwrite_implementation: bool, + #[serde(rename = "beforeHeader", default)] + pub before_header: String, } #[derive(Deserialize)] @@ -83,6 +85,7 @@ pub struct Config { pub rust: Rust, pub rust_edition: RustEdition, pub overwrite_implementation: bool, + pub before_header: String, } impl ConfigPrivate for Config { @@ -492,6 +495,7 @@ fn post_process(config_file: &Path, json: json::Config) -> Result Result<()> { "/* generated by rust_qt_binding_generator */ #ifndef {0} #define {0} - -#include -#include ", guard )?; + if conf.before_header != "" { + writeln!(h, "#include \"{}\"", conf.before_header)?; + } + writeln!(h, " +#include +#include ")?; for name in conf.objects.keys() { writeln!(h, "class {};", name)?;