Skip to content

Instantly share code, notes, and snippets.

@JarrettBillingsley
Created December 13, 2013 03:30
Show Gist options
  • Save JarrettBillingsley/7939420 to your computer and use it in GitHub Desktop.
Save JarrettBillingsley/7939420 to your computer and use it in GitHub Desktop.
type ValNum = f64;
type ValStr = Rc<~str>;
#[deriving(Clone)]
enum Value
{
Null,
Bool(bool),
Num(ValNum),
String(ValStr),
}
// And later...
// self.stack is of type ~[Value]
print!("{}", match self.stack[i]
{
Null => ~"null",
Bool(b) => b.to_str(),
Num(n) => n.to_str(),
String(s) => s.borrow().as_slice()
});
@JarrettBillingsley
Copy link
Author

main.rs:291:4: 291:13 error: cannot move out of dereference of & pointer
main.rs:291                             String(s) => print!("{}", s.borrow().as_slice())
                                        ^~~~~~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment