Skip to main content

Engine

Struct Engine 

Source
pub struct Engine { /* private fields */ }
Expand description

A live script engine: state in scope, script functions in funcs.

Implementations§

Source§

impl Engine

Source

pub fn eval_value( &mut self, src: &str, locals: &[(String, Value)], ) -> Option<Value>

Evaluate an expression to a Value.

Source

pub fn eval_display(&mut self, src: &str, locals: &[(String, Value)]) -> String

Evaluate a {{ }} binding to its display string (empty on error).

Source

pub fn eval_bool(&mut self, src: &str, locals: &[(String, Value)]) -> bool

Evaluate a condition (r-if / r-elif / r-show).

Source

pub fn run_handler(&mut self, src: &str) -> bool

Run an @tap handler (statements or a function call). Returns whether it ran without error (assumed to have changed state).

Source

pub fn eval_value_tracked( &mut self, src: &str, locals: &[(String, Value)], ) -> (Option<Value>, HashSet<String>)

Evaluate an expression and report which signals it read, the binding’s dependency set. Only top-level signal names are returned; loop-locals and function parameters are filtered out. This is the read half of fine-grained reactivity: a binding subscribes to exactly the signals it touches.

Source

pub fn eval_display_tracked( &mut self, src: &str, locals: &[(String, Value)], ) -> (String, HashSet<String>)

Evaluate a {{ }} binding to its display string and report its signal deps (the tracked twin of eval_display).

Source

pub fn eval_bool_tracked( &mut self, src: &str, locals: &[(String, Value)], ) -> (bool, HashSet<String>)

Evaluate a condition and report its signal deps (the tracked twin of eval_bool).

Source

pub fn run_handler_tracked(&mut self, src: &str) -> HashSet<String>

Run an @tap handler and report which signals it changed, the write half. Detected by diffing the signal values across the run, so it needs no cooperation from the handler source (which is arbitrary rhai). Returns an empty set if the handler errored or changed nothing.

Source

pub fn get_string(&mut self, name: &str) -> String

Read a signal’s current value as a display string (for input r-model).

Source

pub fn set_string(&mut self, name: &str, value: &str)

Set a signal to a string value (from input editing).

Auto Trait Implementations§

§

impl !Freeze for Engine

§

impl !RefUnwindSafe for Engine

§

impl !Send for Engine

§

impl !Sync for Engine

§

impl !UnwindSafe for Engine

§

impl Unpin for Engine

§

impl UnsafeUnpin for Engine

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.