Struct Context

Source
pub struct Context;
Expand description

The Context provided by this crate.

Implementations§

Source§

impl Context

Source

pub fn apply( func: Gc<Value<Self>>, args: Vec<Gc<Value<Self>>>, ) -> Result<Gc<Value<Self>>, RuntimeError>

Applies a function to the given arguments.

Trait Implementations§

Source§

impl Clone for Context

Source§

fn clone(&self) -> Context

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl CompilerContext for Context

Source§

type CompileError = CompileError

An error encountered during compilation.
Source§

fn compile( main_module: Symbol, exported_modules: HashMap<Symbol, ExportedModule<Self>>, ) -> Result<Vec<u8>, Self::CompileError>

Compiles a module. Read more
Source§

impl Context for Context

Source§

type BuiltinFunction = fn(Vec<Gc<Value<Context>>>) -> Result<Gc<Value<Context>>, RuntimeError>

The type of a function implemented by the runtime.
Source§

type Expr = Expr

The type of an expression in the AST.
Source§

type ObjectVtable = HashMap<Symbol, Gc<Value<Context>>>

The type of the vtable of an object.
Source§

type UserFunction = (Gc<Expr>, GcLinkedList<(Symbol, Gc<Value<Context>>)>)

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 = ()

The metadata attached to the value.
Source§

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

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

impl Debug for Context

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Context

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Finalize for Context

Source§

impl InterpreterContext for Context

Source§

type RuntimeError = RuntimeError

An error encountered at runtime.
Source§

fn eval( expr: Gc<Expr>, env: &mut GcLinkedList<(Symbol, Gc<Value<Self>>)>, ) -> Result<Gc<Value<Self>>, RuntimeError>

Evaluates an expression.
Source§

fn primitives() -> HashMap<Symbol, Gc<Value<Self>>>

Returns the values in the std/internal/primitives module.
Source§

impl Trace for Context

Source§

unsafe fn trace(&self)

Marks all contained Gcs.
Source§

unsafe fn root(&self)

Increments the root-count of all contained Gcs.
Source§

unsafe fn unroot(&self)

Decrements the root-count of all contained Gcs.
Source§

fn finalize_glue(&self)

Runs Finalize::finalize() on this object and all contained subobjects

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.