| Crates.io | rollr |
| lib.rs | rollr |
| version | 0.2.0 |
| created_at | 2025-04-18 19:52:40.97004+00 |
| updated_at | 2025-04-18 20:20:39.159808+00 |
| description | A lightweight CLI tool and Rust library to roll RPG dice (e.g. 2D20) or flip a coin. |
| homepage | |
| repository | https://github.com/craft-and-code/rollr.git |
| max_upload_size | |
| id | 1639830 |
| size | 22,412 |
A small CLI tool to roll dice or flip a coin using Rust.
2D20, 1D6)flipcoin, flip, or f1D6 if input is missing or malformed| Input | Behavior |
|---|---|
| (none) | Defaults to rolling 1D6 |
D6 |
Interpreted as 1D6 |
2D20 |
Rolls two D20 dice |
3d100 |
Case-insensitive β 3D100 |
1 |
Interpreted as 1D6 |
1D |
Fallback β 1D6 |
2D99 |
Invalid die type β fallback to 2D6 |
fezfe |
Malformed β fallback to 1D6 |
Dice types not included in the supported
enumare automatically rejected and fallback toD6.
This project is structured as a hybrid library + binary crate:
It provides:
src/main.rs,dices.rs: handles parsing and validating dice expressions,throw.rs: handles random dice rolls and coin flips.You can install it with:
cargo add rollr
Or manually add it to your Cargo.toml:
[dependencies]
rollr = "0.1.0"
If youβre using the crate locally (e.g. during development), reference it via a local path:
[dependencies]
rollr = { path = "../path/to/rollr" }
You can also use rollr as a command-line tool without embedding it into another project.
cargo run -- 3D20
cargo run -- flip
Install it as a binary:
cargo install rollr
Then use it from anywhere:
rollr 2D6
rollr flip
Donβt forget to add $HOME/.cargo/bin to your PATH if itβs not already.