+// This file is Copyright its original authors, visible in version control
+// history.
+//
+// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE>
+// or the MIT license <LICENSE-MIT>, at your option.
+// You may not use this file except in accordance with one or both of these
+// licenses.
+
//! Converts a rust crate into a rust crate containing a number of C-exported wrapper functions and
//! classes (which is exportable using cbindgen).
//! In general, supports convering:
let mut out = std::fs::OpenOptions::new().write(true).create(true).truncate(true)
.open(new_file_path).expect("Unable to open new src file");
+ writeln!(out, "// This file is Copyright its original authors, visible in version control").unwrap();
+ writeln!(out, "// history and in the source files from which this was generated.").unwrap();
+ writeln!(out, "//").unwrap();
+ writeln!(out, "// This file is licensed under the license available in the LICENSE or LICENSE.md").unwrap();
+ writeln!(out, "// file in the root of this repository or, if no such file exists, the same").unwrap();
+ writeln!(out, "// license as that which applies to the original source files from which this").unwrap();
+ writeln!(out, "// source was automatically generated.").unwrap();
+ writeln!(out, "").unwrap();
+
writeln_docs(&mut out, &attrs, "");
if module == "" {
writeln!(out, "#![allow(unused_unsafe)]").unwrap();
writeln!(out, "#![allow(unused_braces)]").unwrap();
writeln!(out, "#![deny(missing_docs)]").unwrap();
- writeln!(out, "mod c_types;").unwrap();
- writeln!(out, "mod bitcoin;").unwrap();
+ writeln!(out, "pub mod c_types;").unwrap();
+ writeln!(out, "pub mod bitcoin;").unwrap();
} else {
writeln!(out, "\nuse std::ffi::c_void;\nuse bitcoin::hashes::Hash;\nuse crate::c_types::*;\n").unwrap();
}