Crates.io | lib_dice |
lib.rs | lib_dice |
version | 0.1.0 |
source | src |
created_at | 2017-07-06 23:01:27.260207 |
updated_at | 2017-07-06 23:01:27.260207 |
description | A library for parsing dice rolls |
homepage | https://github.com/twh2898/lib_dice |
repository | https://github.com/twh2898/lib_dice |
max_upload_size | |
id | 22249 |
size | 6,895 |
A dice parsing library uses nom for dice syndax parsing
Cargo.toml
[dependencies]
lib_dice = { git = "https://github.com/twh2898/lib_dice" }
src/main.rs
extern crate lib_dice;
fn main() {
let roll_1 = lib_dice::roll(1, 8, 0); // 1d8 + 0
let roll_2 = lib_dice::roll_from_str("2d6 + 7");
}
$ git clone https://github.com/twh2898/lib_dice.git
$ cd lib_dice
$ cargo run --example demo
The following prompt will start. Close the demo with CTRL + C
Welcome to Dice Line v0.1.0
> 1d8
3
> 3d6 + 8
16
lib_dice uses the MIT Licence