projectmoon
deleted branch keep-drop-refactoring from projectmoon/tenebrous-dicebot
2021-09-30 21:17:49 +00:00
Refactor keep-drop parsing into function, better error handling.
projectmoon
pushed to keep-drop-refactoring at projectmoon/tenebrous-dicebot
2021-09-26 23:19:55 +00:00
Refactor keep-drop parsing into function, better error handling.
projectmoon
pushed to keep-drop-refactoring at projectmoon/tenebrous-dicebot
2021-09-26 23:09:31 +00:00
Keep/Drop Function
Keep/Drop Function
Rust supports tuple destructuring in pattern matching, which may be useful here and the other match:
Keep/Drop Function
Since you have if-else clauses here, it might make more sense to have a third enum member in addition to Keep and Drop, which indicates that we do nothing special with the roll.
Keep/Drop Function
I think it is better to document what the keep expression actually is here, so tacking on "1dXkY" would be useful.
Keep/Drop Function
Instead of unwrap
, you should make use of the features of the Result type. While you will see examples of Rust code around the internet littered with unwrap, you don't actually want to use it except under a few circumstances: