Crate squiid_engine

Source
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 the Bucket 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 the crash-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

§Example Usage

use squiid_engine::execute_multiple_rpn;

let result = execute_multiple_rpn(vec!["5", "3", "+"]);
assert!(result.stack_updated());

Modules§

bucket
command_mappings
crash_reporter
engine

Macros§

execute_single_rpn
Executes a single RPN statement

Structs§

EngineSignalSet
Struct to identify which EngineSignals were triggered during the submission of multiple commands to the engine (usually in execute_rpn_data)

Enums§

EngineSignal
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.