pub enum Intent {
Show 43 variants PrintLast, ReturnLast, ContinueLast, BreakLast, ImportLastAsModule { module_name: String, descope: usize, }, TickCurrentBlock, SetVar { vname: Identifier, access_kind: VarAccessMode, }, DefVar { vname: Identifier, access_kind: VarAccessMode, is_const: bool, }, BuildDynamicGetter { path: Rc<AccessPath>, dynamic_key_count: usize, pending_exprs: Vec<Rc<Sequence>>, override_print: bool, prefer_function: bool, fallback: Option<Rc<Sequence>>, }, GetValue { path: Rc<AccessPath>, dynamic_key_count: usize, override_print: bool, prefer_function: bool, fallback: Option<Rc<Sequence>>, }, BuildDynamicSetter { path: Rc<AccessPath>, write_mode: VarWriteMode, expr_count: usize, pending_exprs: Vec<Rc<Sequence>>, val_source: SetterValueSource, }, SetValue { path: Rc<AccessPath>, write_mode: VarWriteMode, expr_count: usize, }, Invoke { arg_exprs: Rc<Vec<ArgumentExpr>>, arg_eval_count: usize, is_temporal: bool, }, InvokePipeStep { steps: Rc<Vec<FunctionCall>>, step_index: usize, state: InvokePipeStepState, pipeval: Option<RantValue>, assignment_pipe: Option<Rc<AssignmentPipeTarget>>, }, CreateDefaultArgs { context: RantFunctionHandle, default_arg_exprs: Vec<(Rc<Sequence>, usize)>, eval_index: usize, }, Call { argc: usize, override_print: bool, }, CallOperand { sequence: Rc<Sequence>, }, CallTemporal { func: RantFunctionHandle, arg_exprs: Rc<Vec<ArgumentExpr>>, args: Rc<Vec<RantValue>>, temporal_state: TemporalSpreadState, }, BuildList { init: Rc<Vec<Rc<Sequence>>>, index: usize, list: RantList, }, BuildTuple { init: Rc<Vec<Rc<Sequence>>>, index: usize, items: Vec<RantValue>, }, BuildMap { init: Rc<Vec<(MapKeyExpr, Rc<Sequence>)>>, pair_index: usize, map: RantMap, }, BuildWeightedBlock { block: Rc<Block>, weights: Weights, pop_next_weight: bool, }, RuntimeCall { function: Box<dyn FnOnce(&mut VM<'_>) -> RuntimeResult<()>>, interrupt: bool, }, DropStaleUnwinds, Add, Subtract, Multiply, Divide, Modulo, Power, LogicNot, Negate, LogicShortCircuit { on_truthiness: bool, short_circuit_result: LogicShortCircuitHandling, gen_op_intent: Box<dyn FnOnce() -> Intent>, rhs: Rc<Sequence>, }, LogicAnd, LogicOr, LogicXor, Equals, NotEquals, Greater, GreaterOrEqual, Less, LessOrEqual, CheckCondition { conditions: Rc<Vec<(Rc<Sequence>, Rc<Block>)>>, fallback: Option<Rc<Block>>, index: usize, },
}
Expand description

Actions that can be queued on a stack frame that are performed before the frame runs.

“Call” or “Invoke”?

In the context of Rant runtime intents, “calling” and “invoking” have specific meanings:

  • “Invoke” means that argument expressions potentially need to be evaluated before the call can proceed;
  • “Call” means that all argument values are already known (either in the intent or on the value stack).

Variants

PrintLast

Pops a value off the value stack and print it to the current frame’s output.

ReturnLast

Pops a value off the value stack and returns it from the current function.

ContinueLast

Pops a value off the value stack and continues to the next repeater iteration with it.

BreakLast

Pops a value off the value stack and breaks from the current repeater with it.

ImportLastAsModule

Fields

module_name: String
descope: usize

Pops a map off the stack and loads it as a module with the specified name.

TickCurrentBlock

Check if the current block is finished and either continue the block or pop the state from the stack

SetVar

Fields

vname: Identifier
access_kind: VarAccessMode

Pops a value off the stack and assign it to an existing variable.

DefVar

Fields

vname: Identifier
access_kind: VarAccessMode
is_const: bool

Pops a value off the stack and assign it to a new variable.

BuildDynamicGetter

Fields

path: Rc<AccessPath>
dynamic_key_count: usize
pending_exprs: Vec<Rc<Sequence>>
override_print: bool
prefer_function: bool
fallback: Option<Rc<Sequence>>

Pops a block from pending_exprs and evaluate it. If there are no expressions left, switch intent to GetValue.

GetValue

Fields

path: Rc<AccessPath>
dynamic_key_count: usize
override_print: bool
prefer_function: bool
fallback: Option<Rc<Sequence>>

Pops dynamic key values off the stack and runs a getter. If the getter fails, evaluates the fallback.

BuildDynamicSetter

Fields

path: Rc<AccessPath>
write_mode: VarWriteMode
expr_count: usize
pending_exprs: Vec<Rc<Sequence>>
val_source: SetterValueSource

Used to evaluate a setter path with dynamic keys.

Pops a block from pending_exprs and evaluate it. If there are no expressions left, switch intent to SetValue.

SetValue

Fields

path: Rc<AccessPath>
write_mode: VarWriteMode
expr_count: usize

Pops expr_count values off the stack and uses them for expression fields in a setter.

Invoke

Fields

arg_exprs: Rc<Vec<ArgumentExpr>>
arg_eval_count: usize
is_temporal: bool

Evaluates arg_exprs in order, then pops the argument values off the stack, pops a function off the stack, and passes the arguments to the function.

InvokePipeStep

Fields

steps: Rc<Vec<FunctionCall>>

All steps in the entire piped function call

step_index: usize

The current step being executed

state: InvokePipeStepState

Current state of the intent.

pipeval: Option<RantValue>

The pipe value from the last step

assignment_pipe: Option<Rc<AssignmentPipeTarget>>

Optional assignment pipe

Invokes a single function in a piped function call chain.

CreateDefaultArgs

Fields

default_arg_exprs: Vec<(Rc<Sequence>, usize)>
eval_index: usize

Evaluates each sequence in default_arg_exprs in order and assigns their results to local constants with their associated Identifier.

Call

Fields

argc: usize
override_print: bool

Pops argc args off the stack, then pops a function off the stack and calls it with the args.

CallOperand

Fields

sequence: Rc<Sequence>

Calls a sequence without an inner variable scope, then pushes its output to the value stack.

CallTemporal

Fields

arg_exprs: Rc<Vec<ArgumentExpr>>
args: Rc<Vec<RantValue>>
temporal_state: TemporalSpreadState

Calls a function for every variant of a temporal argument set and increments the provided temporal state.

BuildList

Fields

init: Rc<Vec<Rc<Sequence>>>
index: usize
list: RantList

Pops value from stack and adds it to a list. If index is out of range, prints the list.

BuildTuple

Fields

init: Rc<Vec<Rc<Sequence>>>
index: usize
items: Vec<RantValue>

Pops a value from the stack and adds it to items. If index is out of range, produces a tuple from items and prints it.

BuildMap

Fields

init: Rc<Vec<(MapKeyExpr, Rc<Sequence>)>>
pair_index: usize
map: RantMap

Pops a value and optional key from stack and adds them to map. If pair_index is out of range, prints map.

BuildWeightedBlock

Fields

block: Rc<Block>
weights: Weights
pop_next_weight: bool

Evaluates expressions in weights and then runs the block with the computed element weights.

RuntimeCall

Fields

function: Box<dyn FnOnce(&mut VM<'_>) -> RuntimeResult<()>>
interrupt: bool

Calls a function that accepts a mutable reference to the current runtime. Optionally interrupts the intent loop to force another tick.

DropStaleUnwinds

Drops all unwind states that are no longer within the call stack.

Add

Pops two values (RHS, LHS), performs addition, and pushes the result.

Subtract

Pops two values (RHS, LHS), performs subtraction, and pushes the result.

Multiply

Pops two values (RHS, LHS), performs multiplication, and pushes the result.

Divide

Pops two values (RHS, LHS), performs division, and pushes the result.

Modulo

Pops two values (RHS, LHS), performs modulo, and pushes the result.

Power

Pops two values (RHS, LHS), performs exponentiation, and pushes the result.

LogicNot

Pops a value, performs logical NOT, and pushes the result.

Negate

Pops a value, performs negation, and pushes the result.

LogicShortCircuit

Fields

on_truthiness: bool
short_circuit_result: LogicShortCircuitHandling
gen_op_intent: Box<dyn FnOnce() -> Intent>
rhs: Rc<Sequence>

Pops a value off the value stack and compares its truthiness against on_truthiness, and re-pushes the value. If they match, do nothing and continue. If they don’t match, calls gen_op_intent and pushes the returned intent onto the current frame, then evaluates rhs using the CallOperand intent.

LogicAnd

Pops two values, performs logical AND, and pushes the result.

LogicOr

Pops two values, performs logical OR, and pushes the result.

LogicXor

Pops two values (RHS, LHS), performs logical XOR, and pushes the result.

Equals

Pops two values (RHS, LHS), calculates LHS == RHS, and pushes the result.

NotEquals

Pops two values (RHS, LHS), calculates LHS != RHS, and pushes the result.

Greater

Pops two values (RHS, LHS), calculates LHS > RHS, and pushes the result.

GreaterOrEqual

Pops two values (RHS, LHS), calculates LHS >= RHS, and pushes the result.

Less

Pops two values (RHS, LHS), calculates LHS < RHS, and pushes the result.

LessOrEqual

Pops two values (RHS, LHS), calculates LHS <= RHS, and pushes the result.

CheckCondition

Fields

conditions: Rc<Vec<(Rc<Sequence>, Rc<Block>)>>
fallback: Option<Rc<Block>>
index: usize

If index is nonzero, pops a value off the value stack and checks its truthiness. If it’s falsy, pushes the next condition (or fallback) to the call stack and re-pushes this intent with index = index + 1. If it’s truthy, pushes it to the value stack and exits.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.