Struct rurust::vm::VM[][src]

pub struct VM;

A Ruby virtual machine.

Implementations

impl VM[src]

pub fn get() -> &'static Mutex<VM>[src]

Gets the active VM.

pub fn new() -> Result<Self, ErrorKind>[src]

Creates a new Ruby VM.

pub fn eval(&mut self, code: &str) -> Result<Value, ErrorKind>[src]

Evaluates a line of code.

pub fn eval_sandbox(&mut self, code: &str) -> Result<Value, ErrorKind>[src]

Evaluates a line of code in a sandbox.

Any variables defined will not be saved.

pub fn require(&self, file_name: &str) -> Value[src]

requires a file.

pub fn class<S>(&mut self, name: S) -> Class where
    S: Into<String>, 
[src]

Creates a new class.

pub fn module<S>(&mut self, name: S) -> Module where
    S: Into<String>, 
[src]

Creates a new module.

pub fn set_global(&self, name: &str, value: Value) -> Value[src]

Sets the value of a global variable or creates a new one.

pub fn get_global(&self, name: &str) -> Value[src]

Gets the value of a global variable.

pub fn set_global_const(&self, name: &str, value: Value)[src]

Sets a global constant.

pub fn define_global_function(
    &self,
    name: &str,
    f: *mut extern "C" fn() -> Value,
    arg_count: u8
) -> Value
[src]

Defines a global function.

pub fn current_receiver(&self) -> Value[src]

Gets the current receiver (can be nil).

pub fn raise(&self, value: Value, message: &str) -> ![src]

Raises an object and a message.

pub fn fatal(&self, message: &str) -> ![src]

Raises a fatal error.

pub fn bug(&self, message: &str) -> ![src]

Raises a bug.

pub fn warning(&self, message: &str)[src]

Logs a Ruby warning.

pub fn show_ruby_version(&self)[src]

Prints Ruby version info to stdout.

Prints Ruby copyright info to stdout.

pub fn set_script_name(&self, name: &str)[src]

Sets the script name. Essentially the same as $0 = name.

pub fn consume_exception(&mut self) -> Value[src]

Gets the currently raised exception and clears it.

pub fn current_exception(&self) -> Value[src]

Gets the currently raised exception exception.

Can be nil.

Trait Implementations

impl Drop for VM[src]

Auto Trait Implementations

impl RefUnwindSafe for VM[src]

impl Send for VM[src]

impl Sync for VM[src]

impl Unpin for VM[src]

impl UnwindSafe for VM[src]

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.