Like Python’s, Rust’s iterators are "external" in that they are driven
by a caller who calls a next method. This is as opposed to "internal"
iterators who drive themselves and call a callback for each item.
Writing an internal iterator traversing a tree is easy with recursion,
but internal iterators cannot rely on the call stack in that way,
they must save in an explicit object all state that they need to be
preserved across two next calls.
This algorithm uses a Vec as a stack that contains what would be
local variables on the call stack if we could use recursion.