Note: this documentation is currently incorrect and will be updated in the update to 0.1.8.
Embedded_Commands_rs
Embedded_commands_rs is a simple library for adding commands to rust applications.
This library contains two distinct types, the Interpreter and Token types.
The interpreter type represents an instance of a command interpreter and has the following methods:
- new() // generates a new interpreter.
- register(fn( &mut T, &[Token] )) // registers a new command function which takes a mutable reference to T.
- interpret(&mut T, &str) // runs the commands sequentially based on the code written.
The token Type represents an enum which contains any of 4 types:
- an i64
- a f64
- a bool
- a string
Command format example
command1(1,2,3) // this command takes three integers.
command2(1,1.15,true,"abc") // this command takes 4 arguments and expects them to be of the types Token::Int, Token::Float, Token::Str and Token::Bool.
Code example for using this in a console app
use ;
use ;
// --- Commands ---