Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bvssvni
Created January 4, 2014 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bvssvni/8251339 to your computer and use it in GitHub Desktop.
Save bvssvni/8251339 to your computer and use it in GitHub Desktop.
/// Expr wraps a 'proc' that computes a value and a new expression state.
pub struct Expr<T, Env> {
/// Runs the expression and computes the new expression state.
run: proc(&mut Env) -> (T, Expr<T, Env>)
}
pub fn run<Env, V>(env: &mut Env, expr: &mut Expr<V, Env>) -> V {
let (v, n) = (expr.run)(env);
expr.run = n.run;
v
}
Compiler error:
/home/sven/Desktop/prob/src/expr/lib.rs:28:22: 28:30 error: cannot move out of dereference of & pointer
/home/sven/Desktop/prob/src/expr/lib.rs:28 let (v, n) = (expr.run)(env);
^~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment