This project is based on rust-bundler
Creates a single-source-file version of a Cargo package.
extern crate my_lib;
in main.rs
with the contents of lib.rs
.mod my_mod;
declarations into mod my_mod { ... }
blocks.Input: ```rust // src/internal.rs: pub fn hello_world() { println!("Hello, world!"); }
// src/lib.rs: mod internal; pub use internal::hello_world;
// src/main.rs: extern crate example; fn main() { example::hello_world(); } ```
Output:
rust
mod internal {
pub fn hello_world() {
println!("Hello, world!");
}
}
pub use internal::hello_world;
fn main() {
hello_world();
}
More examples in tests/testdata.
Install:
sh
$ cargo install rust_bundler_cp
Run:
sh
$ rust_bundler_cp --input path/to/project >output.rs