The std::mem module provides utilities for working with memory: size_of, align_of, swap, replace, take, drop, forget, and transmute. I use mem::swap to exchange values without cloning, mem::replace to take a value out of a mutable reference, and mem::