| Crates.io | gcj-helper |
| lib.rs | gcj-helper |
| version | 0.5.0 |
| created_at | 2017-03-26 14:07:59.953026+00 |
| updated_at | 2017-04-06 03:36:12.199082+00 |
| description | A helper library for Google Code Jam solutions. |
| homepage | |
| repository | https://github.com/FaultyRAM/gcj-helper-rs |
| max_upload_size | |
| id | 9155 |
| size | 30,953 |
gcj-helper is a Rust library for writing Google Code Jam solutions. It handles the
usual boilerplate (opening files, reading/writing data, etc.), and optionally supports test case
parallelisation.
extern crate gcj_helper;
use gcj_helper::TestEngine;
fn main() {
TestEngine::new("./foo.in", "./foo.out").run(
|input| input.read_next_line().to_owned(),
|data| format!(" {}\n", data),
);
}
cargo new --templateFor brand-new crates, the quickest way to get started is to use a Cargo template:
cargo new --template https://github.com/FaultyRAM/gcj-template-rust.git foobar
This creates a new crate named foobar that is set up to use gcj-helper. No extra work is
needed; just open src/main.rs and start writing your solution.
You can also manually add gcj-helper to your crate, though doing so is slower than using
cargo new --template. To do so, add this line to your [dependencies] in Cargo.toml:
gcj-helper = "0.5"
And add this line to your crate root:
extern crate gcj_helper;
By default, gcj-helper executes each test case in a single thread, one by one. If the parallel
feature is enabled, gcj-helper will attempt to execute multiple test cases simultaneously, but
this relies on third-party dependencies (currently rayon), resulting in slower build times.
If you'd like to enable this feature, open Cargo.toml and replace the following line:
gcj-helper = "0.5"
With this line:
gcj-helper = { version = "0.5", features = ["parallel"] }
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.