[][src]Struct unqlite::document::UnQLiteVm

pub struct UnQLiteVm { /* fields omitted */ }

UnQLite Virtual Machine Object

Wrapper for native unqlite_vm structure, related functions and configuration.

Implementations

impl UnQLiteVm[src]

Virtual Machine Object configuration and execution

pub fn exec(&mut self) -> Result<Option<Value>>[src]

Execute a compiled Jx9 program.

pub fn exec_void(&mut self) -> Result<()>[src]

Execute a compiled Jx9 program. Jx9 script return value ignored.

pub fn dump(&self) -> Result<()>[src]

Dump Jx9 virtual machine instructions to stdout.

pub fn output_to_channel(&mut self) -> Result<Receiver<Vec<u8>>>[src]

Redirect VM output to std::sync::mpsc::Sender<Vec<u8>> and return corresponding Receiver.

Should be called before exec() method.

pub fn output_to_stdout(&self) -> Result<()>[src]

Redirect VM output to stdout. Should be called before exec() method.

pub fn extract_output(&self) -> Result<&[u8]>[src]

If the host application did not install a VM output consumer (output_to_* functions), then the Virtual Machine will automatically redirect its output to an internal buffer. Should be called after exec() method.

pub fn output_length(&self) -> Result<u32>[src]

Return the total number of bytes that have been outputted by the Virtual Machine during program execution.

Should be called after exec() method.

pub fn import_path<T: AsRef<str>>(&self, path: T) -> Result<()>[src]

Add a path to the import search directories for using in include or import Jx9 constructs. Should be called before exec() method.

pub fn report_errors_to_output(&self) -> Result<()>[src]

All Jx9 run-time errors will be reported to the VM output. Should be called before exec() method.

pub fn recursion_depth(&self, max_depth: i32) -> Result<()>[src]

Set a recursion limit to the running script. That is, a function may not call itself (recurse) more than this limit. If this limit is reached then the virtual machine abort the call and null is returned to the caller instead of the function return value.

Should be called before exec() method.

pub fn add_argument<T: AsRef<[u8]>>(&self, arg: T) -> Result<()>[src]

Populate the $argv[n] predefined Jx9 variable. First call of this method setups $argv[0], second $argv[1]...

Should be called before exec() method.

pub fn add_env_attr<K, V>(&self, key: K, value: V) -> Result<()> where
    K: AsRef<[u8]>,
    V: AsRef<[u8]>, 
[src]

Manually populate the $_ENV predefined JSON object which hold environments variable. Should be called before exec() method.

pub fn add_variable<T: Into<Vec<u8>>>(
    &mut self,
    name: T,
    value: Value
) -> Result<()>
[src]

pub fn extract_variable<T: AsRef<[u8]>>(&self, name: T) -> Option<Value>[src]

Extract the content of a variable declared inside your Jx9 script. Should be called before exec() method.

Trait Implementations

impl Clone for UnQLiteVm[src]

impl Drop for UnQLiteVm[src]

fn drop(&mut self)[src]

Destroy a unQLite virtual machine.

impl Send for UnQLiteVm[src]

impl Sync for UnQLiteVm[src]

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.