[][src]Trait rosy::vm::EvalArgs

pub trait EvalArgs: Sized {
    unsafe fn eval_in_object(self, object: impl Into<AnyObject>) -> AnyObject;
unsafe fn eval_in_object_protected(
        self,
        object: impl Into<AnyObject>
    ) -> Result<AnyObject>;
unsafe fn eval_in_mixin(self, mixin: impl Mixin) -> AnyObject;
unsafe fn eval_in_mixin_protected(
        self,
        mixin: impl Mixin
    ) -> Result<AnyObject>; }

A type that can be used as one or more arguments for evaluating code within the context of a Mixin.

The difference between eval_in_object and eval_in_mixin

See the documentation of its implementors for much more detailed information.

Safety

Code executed from self may void the type safety of objects accessible from Rust. For example, if one calls push on an Array<A> with an object of type B, then the inserted object will be treated as being of type A.

For non-protected variants, if an exception is raised due to an argument error or from evaluating the script itself, it should be caught.

Required methods

unsafe fn eval_in_object(self, object: impl Into<AnyObject>) -> AnyObject

Evaluates self in the context of object.

This corresponds directly to rb_obj_instance_eval.

In order to set the context, the variable self is set to object while the code is executing, giving the code access to object's instance variables and private methods.

unsafe fn eval_in_object_protected(
    self,
    object: impl Into<AnyObject>
) -> Result<AnyObject>

Evaluates self in the context of object, returning any raised exceptions.

unsafe fn eval_in_mixin(self, mixin: impl Mixin) -> AnyObject

Evaluates self in the context of mixin.

This corresponds directly to rb_mod_module_eval.

unsafe fn eval_in_mixin_protected(self, mixin: impl Mixin) -> Result<AnyObject>

Evaluates self in the context of mixin, returning any raised exceptions.

Loading content...

Implementations on Foreign Types

impl<O: Object, '_> EvalArgs for &'_ [O][src]

Unchecked arguments directly to the evaluation function.

impl<'_> EvalArgs for &'_ str[src]

The script argument as a UTF-8 string, without any extra information.

impl<S: Into<String>, F: Into<String>> EvalArgs for (S, F)[src]

The script and filename arguments.

impl<S, F, L> EvalArgs for (S, F, L) where
    S: Into<String>,
    F: Into<String>,
    L: Into<Integer>, 
[src]

The script, filename, and line number arguments.

Loading content...

Implementors

impl EvalArgs for String[src]

The script argument without any extra information.

Loading content...