| Crates.io | bundler |
| lib.rs | bundler |
| version | 0.1.1 |
| created_at | 2018-04-22 22:45:27.843357+00 |
| updated_at | 2018-04-23 12:50:51.709157+00 |
| description | Creates a single-source-file version of a Cargo package. |
| homepage | https://github.com/slava-sh/rust-bundler |
| repository | https://github.com/slava-sh/rust-bundler |
| max_upload_size | |
| id | 61868 |
| size | 13,825 |
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:
// src/lib.rs:
mod internal;
pub use internal::hello_world;
// src/internal.rs:
pub fn hello_world() {
println!("Hello, world!");
}
// src/main.rs:
extern crate example;
fn main() {
example::hello_world();
}
Output:
mod internal {
pub fn hello_world() {
println!("Hello, world!");
}
}
pub use internal::hello_world;
fn main() {
hello_world();
}
More examples in tests/testdata.
Install:
$ cargo install bundler
Run:
$ bundle path/to/project >output.rs
[dependencies]
bundler = "0.1.1"
extern crate bundler;
fn main() {
let code = bundler::bundle("path/to/project");
println!("{}", code);
}