die_parser

Crates.iodie_parser
lib.rsdie_parser
version1.0.1
sourcesrc
created_at2022-06-24 17:51:37.931887
updated_at2022-07-14 13:52:22.423006
descriptionThis crate parses the notation for die rolls as used in tabletop games like D&D.
homepage
repositoryhttps://github.com/Weasel01/die_parser
max_upload_size
id612541
size27,110
F. Beizai (Weasel01)

documentation

README

🎲 die_parser

github crates.io docs.rs 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:

Commit count: 8

cargo fmt