lib_dice 0.1.0

A library for parsing dice rolls
Documentation
  • Coverage
  • 75%
    3 out of 4 items documented0 out of 2 items with examples
  • Size
  • Source code size: 9.24 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.46 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 17s Average build duration of successful builds.
  • all releases: 17s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • automas-dev/lib_dice
    0 0 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • twh2898

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