sim-lib-expr-tree 0.2.0

Loadable, Shape-checked SIM expression-tree runtime library.
Documentation
use sim_kernel::{Cx, Expr, Object, ObjectCompat, Result};

/// Unevaluated source transported through the ordinary callable boundary.
pub(crate) struct RawSource(pub(crate) Expr);

impl Object for RawSource {
    fn display(&self, _cx: &mut Cx) -> Result<String> {
        Ok("#<expr-tree-source>".to_owned())
    }

    fn as_any(&self) -> &dyn std::any::Any {
        self
    }
}

impl ObjectCompat for RawSource {
    fn as_expr(&self, _cx: &mut Cx) -> Result<Expr> {
        Ok(self.0.clone())
    }
}