|
|
|
|
|
by nemothekid
388 days ago
|
|
In other words the """safe""" stable code looks like this: let mut data = Vec::with_capacity(sz);
let mut dst_uninit = data.spare_capacity_mut();
let uninit_src: &[MaybeUninit<T>] = unsafe { transmute(buf) };
dst_uninit.copy_from_slice(uninit_src);
unsafe { data.set_len(sz) };
|
|