Struct tcl::interpreter::Interpreter [-] [+] [src]

pub struct Interpreter<'env> {
    // some fields omitted
}

An instance of a Tcl interpreter

Methods

impl<'env> Interpreter<'env>

fn new(env: &TclEnvironment) -> Result<Interpreter, &str>

Create a new Interpreter

unsafe fn raw(&mut self) -> *mut Tcl_Interp

fn is_safe(&self) -> bool

Check whether the interpreter has been marked as safe

fn make_safe(&mut self) -> TclResult

Disable 'unsafe' commands and variables in the interpreter

fn string_result(&self) -> Cow<str>

Get the string result of the last run command

fn object_result(&self) -> Object<'env>

Get a native Tcl object from the last run command

fn eval_file(&mut self, path: &Path) -> TclResult

Evaluate an external file of Tcl code, and store the result internally

fn eval(&mut self, code: &str, eval_scope: EvalScope) -> TclResult

Evaluate a string of Tcl code, and store the result internally

fn eval_object(&mut self, code: &Object, eval_scope: EvalScope, byte_compile: ByteCompile) -> TclResult

Evaluate a Tcl objecrt as code, and store the result internally

fn list_append(&mut self, target: &mut Object, source: &Object) -> TclResult

Append an element to a list This will fail if target is shared

fn expression_boolean<'a>(&'a mut self, expr: &str) -> Result<bool, Cow<'a, str>>

Get the boolean result of an expression

fn expression_boolean_from_object<'a>(&'a mut self, expr: &Object) -> Result<bool, Cow<'a, str>>

fn expression_double<'a>(&'a mut self, expr: &str) -> Result<f64, Cow<'a, str>>

Get the double result of an expression

fn expression_double_from_object<'a>(&'a mut self, expr: &Object) -> Result<f64, Cow<'a, str>>

fn expression_long<'a>(&'a mut self, expr: &str) -> Result<i64, Cow<'a, str>>

Get the long result of an expression

fn expression_long_from_object<'a>(&'a mut self, expr: &Object) -> Result<i64, Cow<'a, str>>

fn expression_object_from_object<'a>(&'a mut self, expr: &Object) -> Result<Object<'env>, Cow<'a, str>>

Get the object result of an expression object

fn expression_string(&mut self, expr: &str) -> TclResult

Process an expression string and store the result

fn set_string_variable(&mut self, var_name: &str, new_value: &str, scope: SetVariableScope, leave_error: LeaveError, append_style: AppendStyle) -> String

Set a simple string variable inside the interpreter

fn set_variable<V: TclObject>(&mut self, var_name: &str, new_value: V) -> Option<Object<'env>>

Sets an object variable using the default options.

See Self::set_object_variable for available options.

fn set_object_variable(&mut self, var_name: &Object, new_value: &Object, scope: SetVariableScope, leave_error: LeaveError, append_style: AppendStyle) -> Option<Object<'env>>

Set an object variable inside the interpreter

fn get_variable(&mut self, var_name: &str, scope: GetVariableScope, leave_error: LeaveError) -> Option<String>

Get a simple string variable inside the interpreter

fn get_object_variable(&mut self, var_name: &str, scope: GetVariableScope, leave_error: LeaveError) -> Option<Object<'env>>

Get a variable as an object

fn unset_variable(&mut self, var_name: &str, scope: GetVariableScope, leave_error: LeaveError) -> TclResult

Unset a variable

Trait Implementations

impl<'env> Drop for Interpreter<'env>

fn drop(&mut self)