die_parser 1.0.1

This crate parses the notation for die rolls as used in tabletop games like D&D.
Documentation
  • Coverage
  • 100%
    13 out of 13 items documented6 out of 9 items with examples
  • Size
  • Source code size: 27.41 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.79 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 17s Average build duration of successful builds.
  • all releases: 17s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Weasel01/die_parser
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Weasel01

🎲 die_parser

License

This crate parses the notation for die rolls as used in tabletop games like D&D.

It aims to do so in the most simple, easy and lightweight way possible.

 Input:
 1.) "2d6"         (Roll 2 six-sided dice.)
 2.) "4d20 - 5"    (Roll 4 twenty-sided dice and subtract 5 from the result.)

 Output:
 1.)    Roll {
         number_of_sides: 6
         number_of_dice: 2
         modifier: 0
        }
 2.)    Roll {
         number_of_sides: 20
         number_of_dice: 4
         modifier: -5
        }

❓ Getting started:

  • Try Roll::parse_roll() !

📖 Documentation:

☕ Buy me a Coffee:

If you like this crate, you can support my work here: