pub unsafe fn copy_to_mapped<T>(data: &[T], mapped: *mut c_void) {
    // SAFETY: TODO: this is all very spooky and unsafe, and still
    // probably invokes U.B somehow. so take a look at this again

    // cast from void ptr and then to slice
    let data_size = (size_of::<T>() * data.len()) as u64;
    let mapped_cast: *mut MaybeUninit<T> = transmute::<*mut c_void, _>(mapped);
    let mapped_slice: &mut [MaybeUninit<T>] =
        slice::from_raw_parts_mut(mapped_cast, data_size as usize);

    // alignment must be correct
    assert!(mapped as usize % std::mem::align_of::<T>() == 0);

    // TODO: if the alignment of the mapped memory isn't correct
    // for the type, we can use ash::util::Align

    // equivalent to memcpy
    ptr::copy_nonoverlapping::<T>(&data[0], mapped_slice[0].as_mut_ptr(), data.len());
}
// copies a slice of T to the memory pointed to by 'mapped'. the size of
// the memory must not be less than the size of the entire slice ('data') for
// this to be safe. used for copying into the mapped memory given by vkMapMemory()
copies a slice of T to the memory pointed to by 'mapped'. the size of
the memory must not be less than the size of the entire slice ('data') for
this to be safe. used for copying into the mapped memory given by vkMapMemory()
copies a slice of T to the memory pointed to by ' mapped ' . the size of the memory must not be less than the size of the entire slice ( ' data ' ) for this to be safe . used for copying into the mapped memory given by vkMapMemory ()
pub unsafe fn copy_to_mapped<T>(data: &[T], mapped: *mut c_void) {
    // SAFETY: TODO: this is all very spooky and unsafe, and still
    // probably invokes U.B somehow. so take a look at this again
    // cast from void ptr and then to slice
    let data_size = (size_of::<T>() * data.len()) as u64;
    let mapped_cast: *mut MaybeUninit<T> = transmute::<*mut c_void, _>(mapped);
    let mapped_slice: &mut [MaybeUninit<T>] =
        slice::from_raw_parts_mut(mapped_cast, data_size as usize);
    // alignment must be correct
    assert!(mapped as usize % std::mem::align_of::<T>() == 0);
    // TODO: if the alignment of the mapped memory isn't correct
    // for the type, we can use ash::util::Align
    // equivalent to memcpy
    ptr::copy_nonoverlapping::<T>(&data[0], mapped_slice[0].as_mut_ptr(), data.len());
}
pub unsafe fn copy_to_mapped < T > ( data : & [ T ] , mapped : * mut c_void ) { // SAFETY: TODO: this is all very spooky and unsafe, and still // probably invokes U.B somehow. so take a look at this again // cast from void ptr and then to slice let data_size = ( size_of :: < T > ( ) * data . len ( ) ) as u64 ; let mapped_cast : * mut MaybeUninit < T > = transmute :: < * mut c_void , _ > ( mapped ) ; let mapped_slice : & mut [ MaybeUninit < T > ] = slice :: from_raw_parts_mut ( mapped_cast , data_size as usize ) ; // alignment must be correct assert ! ( mapped as usize std mem align_of T ( ) 0 ) ; // TODO: if the alignment of the mapped memory isn't correct // for the type, we can use ash::util::Align // equivalent to memcpy ptr :: copy_nonoverlapping :: < T > ( & data [ 0 ] , mapped_slice [ 0 ] . as_mut_ptr ( ) , data . len ( ) ) ; }
copies a slice of T to the memory pointed to by 'mapped'.
copies a slice of T to the memory pointed to by ' mapped ' .
data
&[T]
mapped
*mut c_void
data
&[T]
mapped
*mut c_void