open_cl_low_level/
utils.rs

1use std::mem::ManuallyDrop;
2
3/// Returns a Vec with *actual* length.
4pub fn vec_filled_with<T: Clone>(filler: T, len: usize) -> Vec<T> {
5    let mut out = Vec::with_capacity(len);
6    out.resize(len, filler);
7    out
8}
9
10pub unsafe fn take_manually_drop<T>(slot: &mut ManuallyDrop<T>) -> T {
11    ManuallyDrop::into_inner(std::ptr::read(slot))
12}