[−][src]Function dice_command_parser::parse_line
pub fn parse_line(i: &str) -> Result<DiceRoll, ParserError>
Takes a string of dice input and returns a Result<DiceRoll, ParserError>
The string will be consumed in the process and must strictly match the format of the parser.
Examples
Standard usage:
use dice_command_parser::{parse_line, error::ParserError}; let input = "3d6 - 5"; let dice_roll = parse_line(&input)?;
Errors
This function can fail when one of the following occurs
- The line failed to parse.
- An error occurred parsing the numbers provided. This will likely be an overflow or underflow error.
For more information see ParserError
.