[−][src]Trait recycle_vec::VecExt
A trait that provides an API for recycling Vec's internal buffers
Required methods
fn recycle<U>(self) -> Vec<U>
Allows re-interpreting the type of a Vec to reuse the allocation. The vector is emptied and any values contained in it will be dropped. The target type must have the same size and alignment as the source type. This API doesn't transmute any values of T to U, because it makes sure to empty the vector before any unsafe operations.
Panics
Panics if the size or alignment of the source and target types don't match. Note about stabilization: This contract is enforceable at compile-time, so we'll want to wait until const asserts become stable and modify this API to cause a compile error instead of panicking before stabilizing it.