pub fn json_parse_input(&self, input: &str) -> String {
        let result = parser::parse(self.state.clone(), input);
        let json = match result {
            Ok(ok) => serde_json::to_string(&ok).unwrap(),
            Err(err) => format!(
                "{{\"error\":{}}}",
                serde_json::to_string(&err.to_string()).unwrap()
            ),
        };
        json
    }
/// This is the main function that executes the game. Pass
/// the input string to this function and it will return
/// a result that can be used on the front-end to display
/// the game to the user.
/// Unlike the `parse_input` function, this function will
/// return the result in JSON format. This is useful for
/// front-ends that can't integrate with a rust library.
This is the main function that executes the game. Pass
the input string to this function and it will return
a result that can be used on the front-end to display
the game to the user.
Unlike the `parse_input` function, this function will
return the result in JSON format. This is useful for
front-ends that can't integrate with a rust library.
This is the main function that executes the game . Pass the input string to this function and it will return a result that can be used on the front - end to display the game to the user . Unlike the ` parse_input ` function this function will return the result in JSON format . This is useful for front - ends that can ' t integrate with a rust library .
pub fn json_parse_input(&self, input: &str) -> String {
        let result = parser::parse(self.state.clone(), input);
        let json = match result {
            Ok(ok) => serde_json::to_string(&ok).unwrap(),
            Err(err) => format!(
                "{{\"error\":{}}}",
                serde_json::to_string(&err.to_string()).unwrap()
            ),
        };
        json
    }
pub fn json_parse_input ( & self , input : & str ) -> String { let result = parser :: parse ( self . state . clone ( ) , input ) ; let json = match result { Ok ( ok ) => serde_json :: to_string ( & ok ) . unwrap ( ) , Err ( err ) => format ! ( " \" \" " serde_json to_string ( err to_string ( ) ) unwrap ( ) ) , } ; json }
This is the main function that executes the game.
This is the main function that executes the game .
&self
input
&str
&self
input
&str