Expand description

Provides definitions and implementations for instruction-related functionalities.

Main Structures and Enumerations:

  • InstrType: An enumeration that defines the types of instructions supported, including CONST for constant values and SINE for sinusoidal waves.

  • Instruction: Represents a general instruction composed of a type (InstrType) and a set of arguments (InstrArgs). It offers methods for creating specific instruction types conveniently and for evaluating them.

  • InstrBook: Manages an instruction along with its associated metadata during the experiment editing phase, capturing details like the defined interval and whether to retain a value after the defined interval.

Utilities:

  • The InstrArgs type alias provides a convenient way to define instruction arguments using a dictionary with string keys and float values.

  • The module makes use of the maplit crate to enable easy creation of hashmaps.

Features:

  • Easy creation of instruction objects with utility methods such as new_const and new_sine.
  • Ability to evaluate instructions and in-place populate given time array views with the resulting float-point values.
  • Support for default values in instructions, allowing for flexibility and ease of use.

Structs

  • Manages an instruction along with its associated metadata during experiment editing.
  • Struct for a general instruction, consisting of type and arguments.

Enums

  • Enum type for different instructions. Supported instructions: CONST, SINE

Type Aliases

  • Type alias for instruction arguments: a dictionary with key-value pairs of string (argument name) and float (value)