NodeRef::clone_as_tree_with method can be added to NodeRef::clone_as_tree Further default Clone implementation can make use of NodeRef::clone_as_tree_with to reduce allocation.