Enum rant::runtime::Intent[][src]

pub enum Intent {
    PrintLast,
    ReturnLast,
    ContinueLast,
    BreakLast,
    ImportLastAsModule {
        module_name: String,
        descope: usize,
    },
    CheckBlock,
    SetVar {
        vname: Identifier,
        access_kind: AccessPathKind,
    },
    DefVar {
        vname: Identifier,
        access_kind: AccessPathKind,
        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>>,
        eval_count: usize,
        flag: PrintFlag,
        is_temporal: bool,
    },
    InvokeComposedStep {
        steps: Rc<Vec<FunctionCall>>,
        step_index: usize,
        state: InvokeComposedStepState,
        compval: Option<RantValue>,
        flag: PrintFlag,
    },
    Call {
        argc: usize,
        flag: PrintFlag,
        override_print: bool,
    },
    CallTemporal {
        func: RantFunctionRef,
        args: Rc<Vec<RantValue>>,
        temporal_state: TemporalSpreadState,
        flag: PrintFlag,
    },
    BuildList {
        init: Rc<Vec<Rc<Sequence>>>,
        index: usize,
        list: RantList,
    },
    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,
}

Intents are actions 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

Pop 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

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

Fields of ImportLastAsModule

module_name: Stringdescope: usize
CheckBlock

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

SetVar

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

Fields of SetVar

vname: Identifieraccess_kind: AccessPathKind
DefVar

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

Fields of DefVar

vname: Identifieraccess_kind: AccessPathKindis_const: bool
BuildDynamicGetter

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

Fields of BuildDynamicGetter

path: Rc<AccessPath>dynamic_key_count: usizepending_exprs: Vec<Rc<Sequence>>override_print: boolprefer_function: boolfallback: Option<Rc<Sequence>>
GetValue

Pop dynamic_key_count values off the stack and use them for expression fields in a getter.

Fields of GetValue

path: Rc<AccessPath>dynamic_key_count: usizeoverride_print: boolprefer_function: boolfallback: Option<Rc<Sequence>>
BuildDynamicSetter

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

Fields of BuildDynamicSetter

path: Rc<AccessPath>write_mode: VarWriteModeexpr_count: usizepending_exprs: Vec<Rc<Sequence>>val_source: SetterValueSource
SetValue

Pop expr_count values off the stack and use them for expression fields in a setter.

Fields of SetValue

path: Rc<AccessPath>write_mode: VarWriteModeexpr_count: usize
Invoke

Evaluate arg_exprs in order, then pop the argument values off the stack, pop a function off the stack, and pass the arguments to the function.

Fields of Invoke

arg_exprs: Rc<Vec<ArgumentExpr>>eval_count: usizeflag: PrintFlagis_temporal: bool
InvokeComposedStep

Invoke a single function in a composed function call chain.

Fields of InvokeComposedStep

steps: Rc<Vec<FunctionCall>>

All steps in the entire composed function call

step_index: usize

The current step being executed

state: InvokeComposedStepState

Current state of the intent.

compval: Option<RantValue>

The composition value from the last step

flag: PrintFlag

The print flag to use.

Call

Pop argc args off the stack, then pop a function off the stack and call it with the args.

Fields of Call

argc: usizeflag: PrintFlagoverride_print: bool
CallTemporal

Call a function for every variant of a temporal argument set and increment the provided temporal state.

Fields of CallTemporal

func: RantFunctionRefargs: Rc<Vec<RantValue>>temporal_state: TemporalSpreadStateflag: PrintFlag
BuildList

Pop value from stack and add it to a list. If index is out of range, print the list.

Fields of BuildList

init: Rc<Vec<Rc<Sequence>>>index: usizelist: RantList
BuildMap

Pop value and optional key from stack and add them to a map. If pair_index is out of range, print the map.

Fields of BuildMap

init: Rc<Vec<(MapKeyExpr, Rc<Sequence>)>>pair_index: usizemap: RantMap
BuildWeightedBlock

Evaluate block weights and then run the block

Fields of BuildWeightedBlock

block: Rc<Block>weights: Weightspop_next_weight: bool
RuntimeCall

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

Fields of RuntimeCall

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

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

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,