How to change Box to ptr

pub fn test_transfer_buffer_to_gpu(gpu_context: &Arc<GpuContext>, data: &Box<[u8; 64 * 16]>) {
    unsafe {
            &mut gpu_context.stream_context.clone(),
            &mut gpu_context.cuda_mem_context.clone(),
error[E0308]: mismatched types
   --> src/
180 |             *data.as_ptr()
    |             ^^^^^^^^^^^^^^ expected *-ptr, found `u8`
    = note: expected raw pointer `*const u8`
                      found type `u8`

You already get the pointer, you just don't need to dereference it - change *data.as_ptr() to simply data.as_ptr().

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.