The following two lines:
let x = Box::new((\"slefj\".to_string(), \"a\".to_string()));
let (a, b) = *x;
produce the error:
You have stumbled on a limitation on destructuring and boxes. Luckily, it's easy to work around these. All you need to do is introduce a new intermediary variable that contains the whole structure, and destructure from that:
let x = Box::new(("slefj".to_string(), "a".to_string()));
let pair = *x;
let (a, b) = pair;
The second example:
let pair = *x;
match pair {
Tree::Pair(a, b) => Tree::Pair(a, b),
_ => Tree::Nil,
};