Skip to content

Instantly share code, notes, and snippets.

@MaikKlein
Created June 26, 2013 15:19
Show Gist options
  • Save MaikKlein/5868310 to your computer and use it in GitHub Desktop.
Save MaikKlein/5868310 to your computer and use it in GitHub Desktop.
struct Node{
name: ~str,
child: Option<Node>,
parent: Option<Node>
}
fn main(){
let n1 = Node {name: ~"n11",child: None, parent: None};
let n = Node {name: ~"n",child: Some(n1), parent: None};
match n.child {
Some(ref x) => println(x.name),
None => println("nothing")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment