[][src]Trait artichoke_backend::ValueLike

pub trait ValueLike {
    type Artichoke;
    type Arg;
    type Block;
    type Error: Error;
    fn funcall<T>(
        &self,
        interp: &mut Self::Artichoke,
        func: &str,
        args: &[Self::Arg],
        block: Option<Self::Block>
    ) -> Result<T, Self::Error>
    where
        Self::Artichoke: TryConvert<Self, T>,
        <Self::Artichoke as TryConvert<Self, T>>::Error == Self::Error
;
fn freeze(
        &mut self,
        interp: &mut Self::Artichoke
    ) -> Result<(), Self::Error>;
fn is_frozen(&self, interp: &mut Self::Artichoke) -> bool;
fn is_nil(&self) -> bool;
fn respond_to(
        &self,
        interp: &mut Self::Artichoke,
        method: &str
    ) -> Result<bool, Self::Error>;
fn inspect(&self, interp: &mut Self::Artichoke) -> Vec<u8>;
fn to_s(&self, interp: &mut Self::Artichoke) -> Vec<u8>; fn try_into<T>(self, interp: &Self::Artichoke) -> Result<T, Self::Error>
    where
        Self::Artichoke: TryConvert<Self, T>,
        <Self::Artichoke as TryConvert<Self, T>>::Error == Self::Error
, { ... } }

A boxed Ruby value owned by the interpreter.

Value is equivalent to an RValue in MRI or mrb_value in mruby.

Associated Types

type Artichoke

Concrete type for Artichoke interpreter.

type Arg

Concrete type for arguments passed to funcall.

type Block

Concrete type for blocks passed to funcall.

type Error: Error

Concrete error type for funcall errors.

Loading content...

Required methods

fn funcall<T>(
    &self,
    interp: &mut Self::Artichoke,
    func: &str,
    args: &[Self::Arg],
    block: Option<Self::Block>
) -> Result<T, Self::Error> where
    Self::Artichoke: TryConvert<Self, T>,
    <Self::Artichoke as TryConvert<Self, T>>::Error == Self::Error

Call a method on this [Value] with arguments and an optional block.

Errors

If an exception is raised on the interpreter, then an error is returned.

If a TryConvert conversion fails, then an error is returned.

fn freeze(&mut self, interp: &mut Self::Artichoke) -> Result<(), Self::Error>

Call #freeze on this [Value].

Errors

If an exception is raised on the interpreter, then an error is returned.

fn is_frozen(&self, interp: &mut Self::Artichoke) -> bool

Call #frozen? on this [Value].

fn is_nil(&self) -> bool

Whether self is nil

fn respond_to(
    &self,
    interp: &mut Self::Artichoke,
    method: &str
) -> Result<bool, Self::Error>

Whether self responds to a method.

Equivalent to invoking #respond_to? on this [Value].

Errors

If an exception is raised on the interpreter, then an error is returned.

fn inspect(&self, interp: &mut Self::Artichoke) -> Vec<u8>

Call #inspect on this [Value].

This function can never fail.

fn to_s(&self, interp: &mut Self::Artichoke) -> Vec<u8>

Call #to_s on this [Value].

This function can never fail.

Loading content...

Provided methods

fn try_into<T>(self, interp: &Self::Artichoke) -> Result<T, Self::Error> where
    Self::Artichoke: TryConvert<Self, T>,
    <Self::Artichoke as TryConvert<Self, T>>::Error == Self::Error

Consume self and try to convert self to type T.

Errors

If a TryConvert conversion fails, then an error is returned.

Loading content...

Implementors

impl Value for Value[src]

type Artichoke = Artichoke

type Arg = Self

type Block = Self

type Error = Exception

Loading content...