die-sir 0.1.0

A dice expression parser and evaluator
Documentation
  • Coverage
  • 8%
    2 out of 25 items documented1 out of 1 items with examples
  • Size
  • Source code size: 21.11 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.93 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 21s Average build duration of successful builds.
  • all releases: 21s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • hggmarks/die-sir
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • hggmarks

Die-Sir

Die-Sir (Dicer) is a dice parser for random dice rolling with support for modifiers through basic math operations

Usage

Add this to your Cargo.toml:

[dependencies]

die-sir = "0.1.0"

Basic usage example:

use die_sir::evaluate;

fn main() {
    let result = evaluate("2d6 + 3".to_string());
    match result {
        Ok(val) => println!("Result: {}", val),
        Err(e) => println!("Error: {}", e),
    }
}

Features

  • Parse dice expressions (e.g., "2d6", "1d20+5")
  • Support for basic arithmetic operations (+, -, *, /, ^)
  • Error handling for invalid expressions and number overflow

License

This project is licensed under the MIT License - see the LICENSE file for details