[][src]Struct artichoke_backend::Artichoke

pub struct Artichoke(pub Rc<RefCell<State>>);

Interpreter instance.

The interpreter State is wrapped in an Rc<RefCell<_>>.

The Rc enables the State to be cloned so it can be stored in the sys::mrb_state, extracted in extern "C" functions, and used in Value instances.

The RefCell enables mutable access to the underlying State, even across an FFI boundary.

Functionality is added to the interpreter via traits, for example, garbage collection or eval.

Methods

impl Artichoke[src]

#[must_use]pub unsafe fn into_raw(interp: Self) -> *mut mrb_state[src]

Consume an interpreter and return the pointer to the underlying sys::mrb_state.

This function does not free any interpreter resources. Its intended use is to prepare the interpreter to cross over an FFI boundary.

This is an associated function and must be called as Artichoke::into_raw(interp).

Safety

After calling this function, the caller is responsible for properly freeing the memory occupied by the interpreter heap. The easiest way to do this is to call ffi::from_user_data with the returned pointer and then call Artichoke::close.

pub fn close(self)[src]

Consume an interpreter and free all live Values.

Trait Implementations

impl Clone for Artichoke[src]

impl Convert<Integer, Value> for Artichoke[src]

impl Convert<Option<Value>, Value> for Artichoke[src]

impl Convert<Option<i64>, Value> for Artichoke[src]

impl Convert<Value, Option<Value>> for Artichoke[src]

impl Convert<Value, Value> for Artichoke[src]

impl Convert<bool, Value> for Artichoke[src]

impl Convert<i16, Value> for Artichoke[src]

impl Convert<i32, Value> for Artichoke[src]

impl Convert<i64, Value> for Artichoke[src]

Converter for Artichoke native integer type.

The Int type alias must be i64.

assert_eq!(mem::size_of::<i64>(), mem::size_of::<Int>());
assert_eq!(i64::min_value(), Int::min_value());
assert_eq!(i64::max_value(), Int::max_value());
assert_eq!(TypeId::of::<i64>(), TypeId::of::<Int>());

impl Convert<i8, Value> for Artichoke[src]

impl Convert<u16, Value> for Artichoke[src]

impl Convert<u32, Value> for Artichoke[src]

impl Convert<u8, Value> for Artichoke[src]

impl<'_, '_> ConvertMut<&'_ [&'_ [u8]], Value> for Artichoke[src]

impl<'_, '_> ConvertMut<&'_ [&'_ str], Value> for Artichoke[src]

impl<'_, '_> ConvertMut<&'_ [Option<&'_ [u8]>], Value> for Artichoke[src]

impl<'_, '_> ConvertMut<&'_ [Option<&'_ str>], Value> for Artichoke[src]

impl<'_> ConvertMut<&'_ [Option<Value>], Value> for Artichoke[src]

impl<'_> ConvertMut<&'_ [Option<Vec<u8>>], Value> for Artichoke[src]

impl<'_> ConvertMut<&'_ [String], Value> for Artichoke[src]

impl<'_> ConvertMut<&'_ [Value], Value> for Artichoke[src]

impl<'_> ConvertMut<&'_ [Vec<u8>], Value> for Artichoke[src]

impl<'_> ConvertMut<&'_ [i64], Value> for Artichoke[src]

impl<'_> ConvertMut<&'_ [u8], Value> for Artichoke[src]

impl<'_> ConvertMut<&'_ str, Value> for Artichoke[src]

impl ConvertMut<CaptureMatch, Value> for Artichoke[src]

impl ConvertMut<Float, Value> for Artichoke[src]

impl ConvertMut<HashMap<Vec<u8>, Vec<u8>, RandomState>, Value> for Artichoke[src]

impl<'_> ConvertMut<Option<&'_ [u8]>, Value> for Artichoke[src]

impl<'_> ConvertMut<Option<&'_ str>, Value> for Artichoke[src]

impl ConvertMut<Option<HashMap<Vec<u8>, Option<Vec<u8>>, RandomState>>, Value> for Artichoke[src]

impl ConvertMut<Option<String>, Value> for Artichoke[src]

impl ConvertMut<Option<Vec<u8>>, Value> for Artichoke[src]

impl ConvertMut<Outcome, Value> for Artichoke[src]

impl ConvertMut<RandomNumber, Value> for Artichoke[src]

impl ConvertMut<RandomNumber, Value> for Artichoke[src]

impl ConvertMut<Scan, Option<Value>> for Artichoke[src]

impl ConvertMut<String, Value> for Artichoke[src]

impl ConvertMut<Value, Value> for Artichoke[src]

impl<'_> ConvertMut<Vec<&'_ [u8]>, Value> for Artichoke[src]

impl<'_> ConvertMut<Vec<&'_ str>, Value> for Artichoke[src]

impl ConvertMut<Vec<(Value, Value)>, Value> for Artichoke[src]

impl ConvertMut<Vec<(Vec<u8>, Vec<i64>)>, Value> for Artichoke[src]

impl<'_> ConvertMut<Vec<Option<&'_ [u8]>>, Value> for Artichoke[src]

impl<'_> ConvertMut<Vec<Option<&'_ str>>, Value> for Artichoke[src]

impl ConvertMut<Vec<Option<Vec<u8>>>, Value> for Artichoke[src]

impl ConvertMut<Vec<String>, Value> for Artichoke[src]

impl ConvertMut<Vec<Value>, Value> for Artichoke[src]

impl<'_> ConvertMut<Vec<Vec<Option<&'_ [u8]>>>, Value> for Artichoke[src]

impl<'_> ConvertMut<Vec<Vec<Option<&'_ str>>>, Value> for Artichoke[src]

impl ConvertMut<Vec<Vec<Option<Vec<u8>>>>, Value> for Artichoke[src]

impl ConvertMut<Vec<Vec<u8>>, Value> for Artichoke[src]

impl ConvertMut<Vec<i64>, Value> for Artichoke[src]

impl ConvertMut<Vec<u8>, Value> for Artichoke[src]

impl ConvertMut<f64, Value> for Artichoke[src]

impl Debug for Artichoke[src]

impl DefineConstant for Artichoke[src]

type Value = Value

Concrete type for Ruby values.

type Error = Exception

Concrete error type for fallible operations.

impl Eval for Artichoke[src]

type Value = Value

Concrete type for return values from eval.

type Error = Exception

Concrete error type for eval functions.

impl Globals for Artichoke[src]

type Value = Value

Concrete value type for global variables.

type Error = Exception

Concrete error type for failures manipulating global variables.

fn unset_global_variable<T>(&mut self, name: T) -> Result<(), Self::Error> where
    T: Into<Cow<'static, [u8]>>, 
[src]

Unset global variable pointed to by name.

Unsetting a global variable removes the name from the global storage table. Unset globals resolve to nil in the Ruby VM.

Unsetting a global that is currently unset is a no-op.

Errors

If the name is not a valid global name, an error is returned.

impl Intern for Artichoke[src]

type Symbol = mrb_sym

Concrete type for symbol identifiers. Read more

impl LoadSources for Artichoke[src]

type Artichoke = Self

Concrete type for interpreter.

type Error = Exception

Concrete type for errors returned from filesystem IO.

type Exception = Exception

Concrete type for errors returned by File::require.

impl MrbGarbageCollection for Artichoke[src]

impl Parser for Artichoke[src]

type Context = Context

Concrete type for parser context.

impl TopSelf for Artichoke[src]

type Value = Value

Concrete [Value] type.

impl<T, U> TryConvert<T, U> for Artichoke where
    Artichoke: Convert<T, U>, 
[src]

Provide a fallible converter for types that implement an infallible conversion.

type Error = Exception

Error type for failed conversions.

fn try_convert(&self, value: T) -> Result<U, Self::Error>[src]

Blanket implementation that always succeeds by delegating to Convert::convert.

impl<'a> TryConvert<Value, &'a [u8]> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl<'a> TryConvert<Value, &'a str> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<Value, Float> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<Value, Integer> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl<'a> TryConvert<Value, Option<&'a [u8]>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl<'a> TryConvert<Value, Option<&'a str>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl<'a> TryConvert<Value, Option<String>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl<'a> TryConvert<Value, Option<Vec<u8>>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl<'a> TryConvert<Value, Option<bool>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl<'a> TryConvert<Value, Option<i64>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<Value, String> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl<'a> TryConvert<Value, Vec<&'a [u8]>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl<'a> TryConvert<Value, Vec<&'a str>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<Value, Vec<(Value, Value)>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl<'a> TryConvert<Value, Vec<Option<&'a [u8]>>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl<'a> TryConvert<Value, Vec<Option<&'a str>>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<Value, Vec<Option<String>>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<Value, Vec<Option<Vec<u8>>>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<Value, Vec<String>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<Value, Vec<Value>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<Value, Vec<Vec<u8>>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<Value, Vec<i64>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<Value, Vec<u8>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<Value, bool> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<Value, f64> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<Value, i64> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<Value, u32> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<Value, usize> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvert<u64, Value> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl<'_> TryConvertMut<&'_ OsStr, Value> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl<'a> TryConvertMut<&'a Value, Capture<'a>> for Artichoke[src]

type Error = TypeError

Error type for failed conversions.

impl<'a> TryConvertMut<&'a Value, IntegerString<'a>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvertMut<(Option<Value>, Option<Value>), (Option<Options>, Option<Encoding>)> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvertMut<Option<Value>, Option<Radix>> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvertMut<Option<Value>, RandomNumberMax> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvertMut<Option<Value>, RandomNumberMax> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvertMut<Option<Value>, Seed> for Artichoke[src]

type Error = TypeError

Error type for failed conversions.

impl TryConvertMut<OsString, Value> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl<T, U> TryConvertMut<T, U> for Artichoke where
    Artichoke: ConvertMut<T, U>, 
[src]

Provide a mutable fallible converter for types that implement an infallible conversion.

type Error = Exception

Error type for failed conversions.

fn try_convert_mut(&mut self, value: T) -> Result<U, Self::Error>[src]

Blanket implementation that always succeeds by delegating to Convert::convert.

impl TryConvertMut<Value, RandomNumberMax> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvertMut<Value, RandomNumberMax> for Artichoke[src]

type Error = Exception

Error type for failed conversions.

impl TryConvertMut<Value, Seed> for Artichoke[src]

type Error = TypeError

Error type for failed conversions.

impl Warn for Artichoke[src]

type Error = Exception

Concrete error type for errors encountered when outputting warnings.

Auto Trait Implementations

impl !RefUnwindSafe for Artichoke

impl !Send for Artichoke

impl !Sync for Artichoke

impl Unpin for Artichoke

impl !UnwindSafe for Artichoke

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,