Skip to content

Instantly share code, notes, and snippets.

@SiegeLord
Last active December 18, 2015 04:29
Show Gist options
  • Save SiegeLord/5725452 to your computer and use it in GitHub Desktop.
Save SiegeLord/5725452 to your computer and use it in GitHub Desktop.
Parent-Child ref
fn main()
{
trait Trait
{
}
struct Parent
{
a : Option<~Trait>
}
struct Child;
impl Child
{
fn new<'l>(p : &'l mut Parent) -> &'l Child
{
let ret = ~Child;
p.a = Some(ret as ~Trait);
// ???
}
}
impl Trait for Child
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment