rust_roll/lib.rs
1//! A dice-rolling library and command-line tool using tabletop RPG
2//! notation such as `2d6+3`.
3//!
4//! The library has two parts:
5//!
6//! - [`notation`] parses dice notation into a validated [`notation::Notation`].
7//! - [`roller`] rolls a notation in one of several modes, such as advantage
8//! or ability scores, following the D&D 5e (2014) rules.
9//!
10//! # Examples
11//!
12//! ```
13//! use rust_roll::notation::Notation;
14//! use rust_roll::roller::{roll, RollType};
15//!
16//! let notation: Notation = "d20+5".parse().unwrap();
17//! let rolls = roll(RollType::Advantage(notation), &mut rand::rng());
18//!
19//! assert_eq!(rolls.len(), 2);
20//! assert!(rolls[0].total >= rolls[1].total);
21//! ```
22
23pub mod notation;
24pub mod roller;
25#[cfg(test)]
26mod test_helpers;