[rust-dev] Swapping elements in a vec

Marijn Haverbeke marijnh at gmail.com
Sun Feb 27 23:44:14 PST 2011

> We'll probably wind up with a 'swap'
> primitive at some point down the line when unique ownership and move
> semantics are more thoroughly worked out.

This would be a great use case for syntactic extensions. Seems neater
to do something like this in the standard library than in the core.
(Context: Common Lisp's rotatef is a generalization of swap
implemented simply as a macro.
http://www.lispworks.com/documentation/HyperSpec/Body/m_rotate.htm )

More information about the Rust-dev mailing list