1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
// std imports use std::mem; use std::rt::heap::{deallocate}; /*** Private helper functions follow */ /// Deallocates a buffer of memory #[inline] pub unsafe fn dealloc<T>(ptr: *mut T, len: usize) { if mem::size_of::<T>() != 0 { deallocate(ptr as *mut u8, len * mem::size_of::<T>(), mem::align_of::<T>()) } }