Created
January 4, 2014 03:41
-
-
Save bvssvni/8251339 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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