Trait rust_cuda::lend::BorrowFromRust

source ·
pub trait BorrowFromRust: RustToCuda {
    // Required methods
    unsafe fn with_borrow_from_rust<O, F: FnOnce(&Self) -> O>(
        cuda_repr: DeviceConstRef<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>,
        inner: F,
    ) -> O;
    unsafe fn with_borrow_from_rust_mut<O, F: FnOnce(&mut Self) -> O>(
        cuda_repr_mut: DeviceMutRef<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>,
        inner: F,
    ) -> O
       where Self: SafeMutableAliasing;
    unsafe fn with_moved_from_rust<O, F: FnOnce(Self) -> O>(
        cuda_repr: DeviceOwnedRef<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>,
        inner: F,
    ) -> O
       where Self: Sized + RustToCuda<CudaRepresentation: StackOnly, CudaAllocation: EmptyCudaAlloc>;
}
Available on crate feature device only.

Required Methods§

source

unsafe fn with_borrow_from_rust<O, F: FnOnce(&Self) -> O>( cuda_repr: DeviceConstRef<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>, inner: F, ) -> O

§Safety

This function is only safe to call iff cuda_repr is the DeviceConstRef borrowed on the CPU using the corresponding LendToCuda::lend_to_cuda.

source

unsafe fn with_borrow_from_rust_mut<O, F: FnOnce(&mut Self) -> O>( cuda_repr_mut: DeviceMutRef<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>, inner: F, ) -> O
where Self: SafeMutableAliasing,

§Safety

This function is only safe to call iff cuda_repr_mut is the DeviceMutRef borrowed on the CPU using the corresponding LendToCuda::lend_to_cuda_mut.

source

unsafe fn with_moved_from_rust<O, F: FnOnce(Self) -> O>( cuda_repr: DeviceOwnedRef<'_, DeviceAccessible<<Self as RustToCuda>::CudaRepresentation>>, inner: F, ) -> O
where Self: Sized + RustToCuda<CudaRepresentation: StackOnly, CudaAllocation: EmptyCudaAlloc>,

§Safety

This function is only safe to call iff cuda_repr is the DeviceOwnedRef borrowed on the CPU using the corresponding LendToCuda::move_to_cuda.

Object Safety§

This trait is not object safe.

Implementors§