Skip to content

Instantly share code, notes, and snippets.

@arielb1
Created February 13, 2014 16:17
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 arielb1/8978196 to your computer and use it in GitHub Desktop.
Save arielb1/8978196 to your computer and use it in GitHub Desktop.
use std::cell::RefCell;
struct Context {
data: RefCell<i32>;
}
struct A<'a> {
context: &'a Context,
}
struct BiggerContext {
context: ~Context,
a: A<'context>,
}
fn create_bigger_context() -> ~BiggerContext {
let ctx = ~Context { RefCell::new(0) }
BiggerContext { ctx, A { &ctx } }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment