Skip to content

Instantly share code, notes, and snippets.

@jamesmcm
Created December 6, 2019 00:41
Show Gist options
  • Select an option

  • Save jamesmcm/c897b5c20e23d2985ee71576d6467b68 to your computer and use it in GitHub Desktop.

Select an option

Save jamesmcm/c897b5c20e23d2985ee71576d6467b68 to your computer and use it in GitHub Desktop.
move_child.rs
struct Node {
value: Symbol,
children: (Option<Box<Node>>, Option<Box<Node>>),
}
let movechild = ((&root).as_ref().unwrap().children).1;
(&mut root).as_mut().unwrap().children.1 = Some(Box::new(Node::new(symbol, (movechild, None))));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment