lib_dice

Crates.iolib_dice
lib.rslib_dice
version0.1.0
sourcesrc
created_at2017-07-06 23:01:27.260207
updated_at2017-07-06 23:01:27.260207
descriptionA library for parsing dice rolls
homepagehttps://github.com/twh2898/lib_dice
repositoryhttps://github.com/twh2898/lib_dice
max_upload_size
id22249
size6,895
Thomas Harrison (twh2898)

documentation

https://docs.rs/lib_dice/

README

lib_dice

A dice parsing library uses nom for dice syndax parsing

Usage

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");
}

Example

$ 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

Licence

lib_dice uses the MIT Licence

Commit count: 3

cargo fmt