Skip to main content

DeviceViewMut

Struct DeviceViewMut 

Source
pub struct DeviceViewMut<'a, T: DeviceRepr> { /* private fields */ }
Expand description

Non-owning mutable view over CUDA-accessible device memory.

This type is intentionally not Clone or Copy because it models a unique mutable borrow of a device-memory range for the lifetime 'a.

Implementations§

Source§

impl<'a, T: DeviceRepr> DeviceViewMut<'a, T>

Source

pub const unsafe fn from_raw_parts(ptr: *mut T, length: usize) -> Self

Creates a borrowed mutable device view from a raw pointer and length.

§Safety

ptr must be valid for length contiguous mutable elements of T for the returned lifetime. If length is zero, ptr may be null; the stored view pointer is normalized to NonNull::dangling() because safe borrowed views should not expose null unless a vendor API explicitly requires it. The caller must guarantee unique access to the memory represented by the view.

Source

pub fn from_memory(memory: &'a mut DeviceMemory<T>) -> Self

Source

pub const fn as_ptr(&self) -> *const T

Source

pub const fn as_mut_ptr(&mut self) -> *mut T

Source

pub const fn len(&self) -> usize

Source

pub const fn is_empty(&self) -> bool

Source

pub fn as_view(&self) -> DeviceView<'_, T>

Source

pub fn slice<R: RangeBounds<usize>>( &self, range: R, ) -> Result<DeviceView<'_, T>>

Source

pub fn slice_mut<R: RangeBounds<usize>>( &mut self, range: R, ) -> Result<DeviceViewMut<'_, T>>

Source

pub fn split_at_mut( &mut self, mid: usize, ) -> Result<(DeviceViewMut<'_, T>, DeviceViewMut<'_, T>)>

Trait Implementations§

Source§

impl<'a, T: Debug + DeviceRepr> Debug for DeviceViewMut<'a, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: DeviceRepr> DeviceSlice<T> for DeviceViewMut<'_, T>

Source§

impl<T: DeviceRepr> DeviceSliceMut<T> for DeviceViewMut<'_, T>

Source§

impl<T: DeviceRepr> PushKernelArg for &DeviceViewMut<'_, T>

Source§

fn push_to<'a>(self, params: &mut KernelParameters<'a>)

Source§

impl<T: DeviceRepr> PushKernelArg for &mut DeviceViewMut<'_, T>

Source§

fn push_to<'a>(self, params: &mut KernelParameters<'a>)

Auto Trait Implementations§

§

impl<'a, T> !Send for DeviceViewMut<'a, T>

§

impl<'a, T> !Sync for DeviceViewMut<'a, T>

§

impl<'a, T> !UnwindSafe for DeviceViewMut<'a, T>

§

impl<'a, T> Freeze for DeviceViewMut<'a, T>

§

impl<'a, T> RefUnwindSafe for DeviceViewMut<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Unpin for DeviceViewMut<'a, T>

§

impl<'a, T> UnsafeUnpin for DeviceViewMut<'a, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<B> ByteBuffer for B
where B: DeviceSlice<u8> + ?Sized,

Source§

impl<B> ByteBufferMut for B
where B: DeviceSliceMut<u8> + ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T, B> DeviceBuffer<T> for B
where T: DeviceRepr, B: DeviceSlice<T> + ?Sized,

Source§

impl<T, B> DeviceBufferMut<T> for B
where T: DeviceRepr, B: DeviceBuffer<T> + DeviceSliceMut<T> + ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.