Trait Update

Source
pub trait Update<C: Ctx, E: UserEvent>:
    Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn update(
        &mut self,
        ctx: &mut ExecCtx<C, E>,
        event: &mut Event<E>,
    ) -> Option<Value>;
    fn delete(&mut self, ctx: &mut ExecCtx<C, E>);
    fn typecheck(&mut self, ctx: &mut ExecCtx<C, E>) -> Result<()>;
    fn typ(&self) -> &Type;
    fn refs<'a>(&'a self, f: &'a mut (dyn FnMut(BindId) + 'a));
    fn spec(&self) -> &Expr;
}
Expand description

Update represents a regular graph node, as opposed to a function application represented by Apply. Regular graph nodes are used for every built in node except for builtin functions.

Required Methods§

Source

fn update( &mut self, ctx: &mut ExecCtx<C, E>, event: &mut Event<E>, ) -> Option<Value>

update the node with the specified event and return any output it might generate

Source

fn delete(&mut self, ctx: &mut ExecCtx<C, E>)

delete the node and it’s children from the specified context

Source

fn typecheck(&mut self, ctx: &mut ExecCtx<C, E>) -> Result<()>

type check the node and it’s children

Source

fn typ(&self) -> &Type

return the node type

Source

fn refs<'a>(&'a self, f: &'a mut (dyn FnMut(BindId) + 'a))

record any variables the node references by calling f

Source

fn spec(&self) -> &Expr

return the original expression used to compile this node

Implementors§