问题
Google turns up many links on old methods that have now been removed from the language, but I can't find a reference on what to do for Rust 0.6.
I've just implemented a linked list, which I could easily repurpose into a stack, but I'd rather use some well-tested, robust, existing data structure from the standard library.
回答1:
I would try, in order :
- a deque
- a list or a dlist
- a vec
- a mutable owned vector
You can learn more about the containers on the wiki.
来源:https://stackoverflow.com/questions/15886661/whats-the-right-way-to-make-a-stack-or-other-dynamically-resizable-vector-like