impl TryInto<&DeviceMemory<T>> for &[T]
From !70 (merged)
-
&[T]is used as a dynamic view which may be bothPageLockedMemoryandDeviceMemory -
We can get where the array actually exists using
Memory::memory_type() -
Is it possible to dynamically downcast it like following?
let mem = DeviceMemory::<i32>::zeros(ctx, 10); let sl: &[i32] = mem.as_slice(); let mem2: DeviceMemory<i32> = sl.try_into().unwrap();
Problems
- How to get
Context? - How to construct a reference with avoiding double free problem?
Edited by termoshtt