pub trait Apply<C: Ctx, E: UserEvent>:
Debug
+ Send
+ Sync
+ 'static {
// Required method
fn update(
&mut self,
ctx: &mut ExecCtx<C, E>,
from: &mut [Node<C, E>],
event: &mut Event<E>,
) -> Option<Value>;
// Provided methods
fn delete(&mut self, _ctx: &mut ExecCtx<C, E>) { ... }
fn typecheck(
&mut self,
_ctx: &mut ExecCtx<C, E>,
_from: &mut [Node<C, E>],
) -> Result<()> { ... }
fn typ(&self) -> Arc<FnType> { ... }
fn refs<'a>(&'a self, _f: &'a mut (dyn FnMut(BindId) + 'a)) { ... }
}Expand description
Apply is a kind of node that represents a function application. It does not hold ownership of it’s arguments, instead those are held by a CallSite node. This allows us to change the function called at runtime without recompiling the arguments.
Required Methods§
fn update( &mut self, ctx: &mut ExecCtx<C, E>, from: &mut [Node<C, E>], event: &mut Event<E>, ) -> Option<Value>
Provided Methods§
Sourcefn delete(&mut self, _ctx: &mut ExecCtx<C, E>)
fn delete(&mut self, _ctx: &mut ExecCtx<C, E>)
delete any internally generated nodes, only needed for builtins that dynamically generate code at runtime
Sourcefn typecheck(
&mut self,
_ctx: &mut ExecCtx<C, E>,
_from: &mut [Node<C, E>],
) -> Result<()>
fn typecheck( &mut self, _ctx: &mut ExecCtx<C, E>, _from: &mut [Node<C, E>], ) -> Result<()>
apply custom typechecking to the lambda, only needed for builtins that take lambdas as arguments
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".