Expand description
§Squiid Engine
Squiid Engine provides a reverse Polish notation (RPN) calculation engine, along with utilities for managing commands, processing input, and handling execution signals.
§Modules
bucket
: Defines theBucket
type used for storing values in the engine.command_mappings
: Contains the mapping of commands to their respective functions.engine
: Implements the core RPN engine.crash_reporter
(optional): Handles crash reporting when thecrash-reporting
feature is enabled.
§Global Structures
ENGINE
: A globally accessible instance of the RPN engine.COMMAND_MAPPINGS
: A lookup table mapping commands to engine operations.
§Core Functionality
handle_data
: Processes a single RPN command or numeric input.execute_multiple_rpn
: Executes a series of RPN commands in sequence.get_stack
: Retrieves the current stack state.get_commands
: Returns a list of valid commands.get_previous_answer
: Fetches the last computed result.update_previous_answer
: Updates the stored previous answer in the engine.
§Example Usage
use squiid_engine::execute_multiple_rpn;
let result = execute_multiple_rpn(vec!["5", "3", "+"]);
assert!(result.stack_updated());
Modules§
Macros§
- execute_
single_ rpn - Executes a single RPN statement
Structs§
- Engine
Signal Set - Struct to identify which
EngineSignal
s were triggered during the submission of multiple commands to the engine (usually inexecute_rpn_data
)
Enums§
- Engine
Signal - Represents the different signals that can be returned by the engine.
Functions§
- execute_
multiple_ rpn - Execute multiple RPN commands in the engine sequentially.
- get_
commands - Get a list of valid commands that the engine accepts
- get_
previous_ answer - Get the current previous answer from the engine.
- get_
stack - Get the current stack from the engine.
- handle_
data - Processes a single RPN command or numeric input.
- update_
previous_ answer - Update the previous answer variable in the engine.