Copy data from the array into a vec on the host. **This will not check if the formats match, it does however yield a correct vec**. Format mismatch and especially format size mismatch may yield incorrect (but not unsound!) behavior
(&self)
| 838 | /// however yield a correct vec**. Format mismatch and especially format size mismatch may yield incorrect (but not unsound!) |
| 839 | /// behavior |
| 840 | pub fn as_host_vec<T: ArrayPrimitive>(&self) -> CudaResult<Vec<T>> { |
| 841 | let desc = self.descriptor()?; |
| 842 | let self_size = desc.width() |
| 843 | * desc.height().max(1) |
| 844 | * desc.depth().max(1) |
| 845 | * desc.num_channels() as usize |
| 846 | * desc.format().mem_size(); |
| 847 | |
| 848 | let len = self_size / T::array_format().mem_size(); |
| 849 | unsafe { |
| 850 | // SAFETY: anything ArrayPrimitive is a number and therefore zeroable. |
| 851 | let mut vec = vec![zeroed(); len]; |
| 852 | self.copy_to(&mut vec)?; |
| 853 | Ok(vec) |
| 854 | } |
| 855 | } |
| 856 | } |
| 857 | |
| 858 | impl std::fmt::Debug for ArrayObject { |
no test coverage detected