Trait rust_cuda::safety::StackOnly

source ·
pub auto trait StackOnly { }
Expand description

Types which contain no pointers or references and can thus live entirely on the stack.

This trait is automatically implemented when the compiler determines it’s appropriate.

Note that this trait is sealed, i.e. you cannot implement it on your own custom types.

Primitive types like u8 and structs, tuples, and enums made only from them implement StackOnly.

In contrast, &T, &mut T, *const T, *mut T, and any type containing a reference or a pointer do not implement StackOnly.

§Examples

fn assert_stackonly(_x: impl StackOnly) {}
assert_stackonly(42); // ok
assert_stackonly([42; 42]); // ok
assert_stackonly(vec![42]); // error
assert_stackonly(&42); // error
assert_stackonly(ThreadBlockShared::new_uninit()); // error
assert_stackonly(ThreadBlockSharedSlice::new_uninit_with_len(0)); // error

Implementations on Foreign Types§

source§

impl<T> StackOnly for PhantomData<T>

source§

impl<T: ?Sized> !StackOnly for *const T

source§

impl<T: ?Sized> !StackOnly for *mut T

source§

impl<T: ?Sized> !StackOnly for &T

source§

impl<T: ?Sized> !StackOnly for &mut T

Implementors§

Auto implementors§

§

impl !StackOnly for RawPtxKernel

§

impl StackOnly for NoCudaAlloc

§

impl StackOnly for SomeCudaAlloc

§

impl StackOnly for PTXAllocator

§

impl StackOnly for Dim3

§

impl StackOnly for Idx3

§

impl StackOnly for Thread

§

impl StackOnly for ThreadBlock

§

impl StackOnly for ThreadBlockGrid

§

impl StackOnly for LaunchConfig

§

impl StackOnly for NoCompletion

§

impl<'a, 'stream, T> !StackOnly for AsyncProj<'a, 'stream, T>

§

impl<'a, 'stream, T, C = NoCompletion> !StackOnly for Async<'a, 'stream, T, C>

§

impl<'a, T> !StackOnly for HostAndDeviceConstRef<'a, T>

§

impl<'a, T> !StackOnly for HostAndDeviceMutRef<'a, T>

§

impl<'a, T> !StackOnly for HostAndDeviceOwned<'a, T>

§

impl<'r, T> !StackOnly for DeviceConstRef<'r, T>

§

impl<'r, T> !StackOnly for DeviceMutRef<'r, T>

§

impl<'r, T> !StackOnly for DeviceOwnedRef<'r, T>

§

impl<'stream> !StackOnly for Stream<'stream>

§

impl<'stream, 'kernel, Kernel> !StackOnly for Launcher<'stream, 'kernel, Kernel>

§

impl<A, B> StackOnly for CombinedCudaAlloc<A, B>
where A: StackOnly, B: StackOnly,

§

impl<C> StackOnly for CudaDropWrapper<C>
where C: StackOnly,

§

impl<Kernel> !StackOnly for TypedPtxKernel<Kernel>

§

impl<T> !StackOnly for ExchangeWrapperOnDevice<T>

§

impl<T> !StackOnly for ExchangeWrapperOnHost<T>

§

impl<T> !StackOnly for DeviceConstPointer<T>

§

impl<T> !StackOnly for DeviceMutPointer<T>

§

impl<T> !StackOnly for DeviceOwnedPointer<T>

§

impl<T> !StackOnly for ThreadBlockShared<T>

§

impl<T> !StackOnly for ThreadBlockSharedSlice<T>

§

impl<T> StackOnly for DeepPerThreadBorrow<T>

§

impl<T> StackOnly for PerThreadShallowCopy<T>

§

impl<T> StackOnly for PtxJit<T>

§

impl<T> StackOnly for ShallowInteriorMutable<T>

§

impl<T> StackOnly for DeviceCopyWithPortableBitSemantics<T>
where T: StackOnly,

§

impl<T> StackOnly for RustToCudaWithPortableBitCloneSemantics<T>
where T: StackOnly,

§

impl<T> StackOnly for RustToCudaWithPortableBitCopySemantics<T>
where T: StackOnly,

§

impl<T> StackOnly for SplitSliceOverCudaThreadsDynamicStride<T>
where T: StackOnly,

§

impl<T> StackOnly for DeviceAccessible<T>
where T: StackOnly,

§

impl<T, const M2D: bool, const M2H: bool> !StackOnly for CudaExchangeBuffer<T, M2D, M2H>

§

impl<T, const M2D: bool, const M2H: bool> StackOnly for CudaExchangeItem<T, M2D, M2H>

§

impl<T, const STRIDE: usize> StackOnly for SplitSliceOverCudaThreadsConstStride<T, STRIDE>
where T: StackOnly,