Function vampirc_uci::parser::parse_strict
source · [−]pub fn parse_strict(s: &str) -> Result<MessageList, Error<Rule>>
Expand description
Parses the specified &str s
into a list of UciMessage
s. Please note that this method will return an Error
if
any of the input violates the grammar rules.
The UCI messages are separated by a newline character, as per the UCI protocol specification.
This method differs from the parse(..)
method in the fact that any unrecognized tokens/messages will result in
an error being returned.
Examples
use vampirc_uci::UciMessage;
use vampirc_uci::parse_strict;
let messages = parse_strict("position startpos\ngo ponder searchmoves e2e4 d2d4\n").unwrap();
assert_eq!(messages.len(), 2);