Asynchronously allocate a new buffer of the same size as `slice`, initialized with a clone of the data in `slice`. # Safety For why this function is unsafe, see [AsyncCopyDestination](trait.AsyncCopyDestination.html) # Errors If the allocation fails, returns the error from CUDA. # Examples ``` # let _context = cust::quick_init().unwrap(); use cust::memory::*; use cust::stream::{Stream, Strea
(slice: &[T], stream: &Stream)
| 385 | /// } |
| 386 | /// ``` |
| 387 | pub unsafe fn from_slice_async(slice: &[T], stream: &Stream) -> CudaResult<Self> { |
| 388 | let mut uninit = DeviceBuffer::uninitialized_async(slice.len(), stream)?; |
| 389 | uninit.async_copy_from(slice, stream)?; |
| 390 | Ok(uninit) |
| 391 | } |
| 392 | |
| 393 | /// Explicitly creates a [`DeviceSlice`] from this buffer. |
| 394 | pub fn as_slice(&self) -> &DeviceSlice<T> { |
nothing calls this directly
no test coverage detected