Struct rurust::vm::VM [−][src]
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]
require
s a file.
pub fn class<S>(&mut self, name: S) -> Class where
S: Into<String>,
[src]
S: Into<String>,
Creates a new class.
pub fn module<S>(&mut self, name: S) -> Module where
S: Into<String>,
[src]
S: Into<String>,
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]
&self,
name: &str,
f: *mut extern "C" fn() -> Value,
arg_count: u8
) -> Value
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.
pub fn show_ruby_copyright(&self)
[src]
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,