Trait rust_cuda::lend::LendToCuda
source · pub trait LendToCuda: RustToCuda {
// Required methods
fn lend_to_cuda<O, E: From<CudaError>, F: FnOnce(HostAndDeviceConstRef<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>) -> Result<O, E>>(
&self,
inner: F,
) -> Result<O, E>
where Self: Sync;
fn lend_to_cuda_mut<O, E: From<CudaError>, F: FnOnce(HostAndDeviceMutRef<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>) -> Result<O, E>>(
&mut self,
inner: F,
) -> Result<O, E>
where Self: Sync + SafeMutableAliasing;
fn move_to_cuda<O, E: From<CudaError>, F: FnOnce(HostAndDeviceOwned<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>) -> Result<O, E>>(
self,
inner: F,
) -> Result<O, E>
where Self: Send + RustToCuda<CudaRepresentation: StackOnly, CudaAllocation: EmptyCudaAlloc>;
}Available on crate feature
host only.Required Methods§
sourcefn lend_to_cuda<O, E: From<CudaError>, F: FnOnce(HostAndDeviceConstRef<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>) -> Result<O, E>>(
&self,
inner: F,
) -> Result<O, E>where
Self: Sync,
fn lend_to_cuda<O, E: From<CudaError>, F: FnOnce(HostAndDeviceConstRef<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>) -> Result<O, E>>(
&self,
inner: F,
) -> Result<O, E>where
Self: Sync,
Lends an immutable borrow of &self to CUDA:
- code in the CUDA kernel can only access
&selfthrough theDeviceConstRefinside the closure - after the closure,
&selfwill not have changed
§Errors
Returns a CudaError iff an error occurs inside CUDA
sourcefn lend_to_cuda_mut<O, E: From<CudaError>, F: FnOnce(HostAndDeviceMutRef<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>) -> Result<O, E>>(
&mut self,
inner: F,
) -> Result<O, E>where
Self: Sync + SafeMutableAliasing,
fn lend_to_cuda_mut<O, E: From<CudaError>, F: FnOnce(HostAndDeviceMutRef<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>) -> Result<O, E>>(
&mut self,
inner: F,
) -> Result<O, E>where
Self: Sync + SafeMutableAliasing,
Lends a mutable borrow of &mut self to CUDA iff Self is
SafeMutableAliasing:
- code in the CUDA kernel can only access
&mut selfthrough theDeviceMutRefinside the closure - after the closure,
&mut selfwill reflect the changes from the kernel execution
§Errors
Returns a rustacuda::errors::CudaError iff an error occurs inside CUDA
sourcefn move_to_cuda<O, E: From<CudaError>, F: FnOnce(HostAndDeviceOwned<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>) -> Result<O, E>>(
self,
inner: F,
) -> Result<O, E>
fn move_to_cuda<O, E: From<CudaError>, F: FnOnce(HostAndDeviceOwned<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>) -> Result<O, E>>( self, inner: F, ) -> Result<O, E>
Object Safety§
This trait is not object safe.