rust-bundler-cp
rust-bundler-cp copied to clipboard
rust-bundler-cp bundles a cargo package into a single rust file. It's designed for Competitive programming like Codeforces.
rust-bundler-cp
This project is based on rust-bundler
Creates a single-source-file version of a Cargo package. It's designed for Competitive Programming like Codeforces.
Features
- Uses Syn to parse and manipulate a complete syntax tree, instead of doing replacement with regular expression.
- Replaces
extern crate my_lib;inmain.rswith the contents oflib.rs. - Expands
mod my_mod;declarations intomod my_mod { ... }blocks. - rustfmt needs to be available in
PATH, i.e.dnf install rustfmt. I'll consider bundlerustfmtin my code later. - Unsupported: External
[dependencies]inCargo.toml
Example
Endle's codeforces template is co-evoloved with rust-bundler-cp, and is considered as the example of it.
Usage
Install:
$ cargo install rust_bundler_cp
Run:
$ rust_bundler_cp --input path/to/project >output.rs
$ rust_bundler_cp --input path/to/project --binary a
Similar Projects
- This project is based on slava-sh /rust-bundler
- lpenz/rust-sourcebundler is based on regular expressions, whereas this project manipulates the syntax tree
- MarcosCosmos/cg-rust-bundler
- golang.org/x/tools/cmd/bundle for Go