Skip to main content

Module notation

Module notation 

Source
Expand description

Parsing and validation of dice notation.

Notation takes the form XdY?Z: an optional number of dice X, a die with Y sides, and an optional modifier made of an operator (+, -, * or /) and a value Z. Whitespace between the parts is ignored, and d may be upper or lower case.

A Notation can only be created through Notation::try_new or by parsing, so every notation built from user input is within bounds.

Structs§

Modifier
A validated operator and value applied to a roll’s total.
Notation
A validated dice expression, such as 2d6+3.

Enums§

NotationError
An error from parsing or constructing dice notation.
Operator
An arithmetic operator in a modifier.

Constants§

MAX_VALUE
The largest value allowed for the number of dice, the number of sides, or a modifier’s value.