die-sir

Crates.iodie-sir
lib.rsdie-sir
version0.1.0
created_at2025-03-14 01:28:56.039559+00
updated_at2025-03-14 01:28:56.039559+00
descriptionA dice expression parser and evaluator
homepage
repositoryhttps://github.com/hggmarks/die-sir
max_upload_size
id1591699
size21,604
Hugo Marques (hggmarks)

documentation

README

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

Commit count: 21

cargo fmt