[−][src]Crate mice
mice, messing with dice
The heading obviates the need for a body.
This crate is written primarily for my own usage, and will likely obtain extensions related to games that I play.
Some basic usage:
println!("{}", roll("2d6 + 3")?); println!("{}", roll("2d6 + 3")?.total()); let result = roll("2d6 + 3")?; println!("{}\n{}", result, result.total());
The parser accepts an arbitrary number of terms in a dice expression.
println!("{}", roll("9d8 + 4d2 - 5 - 8d7")?);
Re-exports
pub use parse::ParseError; |
Modules
builder | A builder for rolling stuff.
This API affords more flexibility than the basic one.
Specifically, it allows a user to provide their own
RNG in the place of the default |
parse | Types and parsers for dice expressions. |
prelude | Re-export of primary useful things in |
util | Nice to have utilities that aren't core to dice manipulation itself, just handy for some reason. |
Structs
ExpressionResult | The result of evaluating a dice expression. |
FormatOptions | Formatting options for dice expressions. Necessary for stability of user facing output, which is this library's primary concern. |
OverflowNegative | |
OverflowPositive |
Enums
Error | Most general mice error type. Exported as |
Functions
roll | Evaluate a dice expression! This function takes the usual dice expression format, and allows an arbitrary number of terms. |
roll_tuples | Roll and sum a slice of tuples, in the form
provided by this function's complement: |
tuple_vec | Get a |