Skip to main content

DevicePtrMut

Trait DevicePtrMut 

Source
pub unsafe trait DevicePtrMut<T: DeviceRepr>: DevicePtr<T> {
    // Required method
    fn device_ptr_mut(&mut self) -> CUdeviceptr;
}
Expand description

A DevicePtr that supports writes.

Implementors must hold a unique reference to the underlying storage for the pointer’s lifetime — e.g. &mut DeviceBuffer<T> or DeviceSliceMut<'_, T>. This gives the trait the same borrow-checker properties as &mut [T].

§Safety

Implementors must guarantee that device_ptr_mut returns a pointer that is unique for the duration of the &mut self borrow — no other live pointer may alias it. Violating this lets concurrent kernels observe writes in any order, breaking the borrow-checker contract &mut [T] is meant to mirror.

Required Methods§

Source

fn device_ptr_mut(&mut self) -> CUdeviceptr

Raw mutable device pointer.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: DeviceRepr, P: DevicePtrMut<T> + ?Sized> DevicePtrMut<T> for &mut P

Implementors§