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

pub enum Intent {
    PrintValue,
    CheckBlock,
    SetVar {
        vname: Identifier,
        access_kind: AccessPathKind,
    },
    DefVar {
        vname: Identifier,
        access_kind: AccessPathKind,
    },
    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>,
        auto_def: bool,
        expr_count: usize,
        pending_exprs: Vec<Rc<Sequence>>,
        val_source: SetterValueSource,
    },
    SetValue {
        path: Rc<AccessPath>,
        auto_def: bool,
        expr_count: usize,
    },
    Invoke {
        arg_exprs: Rc<Vec<Rc<Sequence>>>,
        eval_count: usize,
        flag: PrintFlag,
    },
    Call {
        argc: usize,
        flag: PrintFlag,
        override_print: bool,
    },
    BuildList {
        init: Rc<Vec<Rc<Sequence>>>,
        index: usize,
        list: RantList,
    },
    BuildMap {
        init: Rc<Vec<(MapKeyExpr, Rc<Sequence>)>>,
        pair_index: usize,
        map: RantMap,
    },
    LoadModule {
        module_name: String,
    },
    RuntimeCall(Box<dyn FnOnce(&mut VM<'_>) -> RuntimeResult<()>>),
}

Intents are actions queued on a stack frame that are performed before the frame runs.

Variants

PrintValue

Take the pending output from last frame and print it.

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: AccessPathKind
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>auto_def: boolexpr_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>auto_def: boolexpr_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<Rc<Sequence>>>eval_count: usizeflag: PrintFlag
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
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
LoadModule

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

Fields of LoadModule

module_name: String
RuntimeCall(Box<dyn FnOnce(&mut VM<'_>) -> RuntimeResult<()>>)

Calls a function that accepts a mutable reference to the current runtime.

Auto Trait Implementations

impl !RefUnwindSafe for Intent

impl !Send for Intent

impl !Sync for Intent

impl Unpin for Intent

impl !UnwindSafe for Intent

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>,