Trait Context

Source
pub trait Context: Sized {
    type BuiltinFunction: Clone + Debug + Finalize + Trace;
    type Expr: Clone + Debug + Finalize + Trace;
    type ObjectVtable: Clone + Debug + Finalize + Trace;
    type UserFunction: Clone + Debug + Finalize + Trace;
    type ValueMeta: Clone + Debug + Default + Finalize + Trace;

    // Required method
    fn from_expr(expr: Gc<Expr<Self>>) -> Gc<Self::Expr>;
}
Expand description

A trait for the things a Value is parameterized over.

Yeah, it’s vague. Basically, think of it as a collection of associated types that is used to define Value.

Required Associated Types§

Source

type BuiltinFunction: Clone + Debug + Finalize + Trace

The type of a function implemented by the runtime.

Source

type Expr: Clone + Debug + Finalize + Trace

The type of an expression in the AST.

Source

type ObjectVtable: Clone + Debug + Finalize + Trace

The type of the vtable of an object.

Source

type UserFunction: Clone + Debug + Finalize + Trace

The type of a user function. This probably should just be the arguments (as an Args<C>), the body (as C::Expr), and the variables closed over and their values (as a GcLinkedList<(Symbol, Value<C>)>).

Source

type ValueMeta: Clone + Debug + Default + Finalize + Trace

The metadata attached to the value.

Required Methods§

Source

fn from_expr(expr: Gc<Expr<Self>>) -> Gc<Self::Expr>

Converts a standard ast::Expr to the expression type of the context.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§