Skip to main content

DeviceInputView

Struct DeviceInputView 

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

Typed CUDA input metadata without an initialization guarantee.

Construction checks the element layout and preserves the allocation’s context and range. Reading values requires an unsafe consumer to establish initialization and order preceding producers before each read.

Implementations§

Source§

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

Source

pub fn create(region: DeviceRegion<'a>) -> Result<Self>

Describes a live allocation range as input elements of T.

§Errors

Returns an error if T is zero-sized, the region’s byte length is not divisible by size_of::<T>(), or a nonempty region is not aligned for T.

Source

pub fn from_buffer<B: DeviceRange<T> + ?Sized>(buffer: &'a B) -> Self

Borrows typed input metadata without strengthening its validity contract.

Source

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

Returns the CUDA-accessible element pointer.

An empty view returns an aligned dangling pointer. This pointer does not grant host access.

Source

pub const fn len(&self) -> usize

Returns the number of elements in the view.

Source

pub const fn is_empty(&self) -> bool

Returns whether the view contains no elements.

Source

pub fn context(&self) -> &'a Arc<Context> ⓘ

Returns the context associated with the viewed allocation.

Source

pub const fn region(&self) -> DeviceRegion<'a>

Returns the view’s exact byte range and allocation identity.

Source

pub fn slice<R: RangeBounds<usize>>(self, range: R) -> Result<Self>

Narrows input metadata while preserving its allocation identity and offset.

§Errors

Returns an error if the element range is reversed, exceeds this range’s bounds, or an inclusive bound cannot be converted without overflow.

Source

pub fn cast<U: DeviceRepr>(self) -> Result<DeviceInputView<'a, U>>

Reinterprets input metadata without asserting initialized destination values.

§Errors

Returns an error if U is zero-sized, the region’s byte length is not divisible by size_of::<U>(), or a nonempty region is not aligned for U.

Trait Implementations§

Source§

impl<'a, T: Clone + DeviceRepr> Clone for DeviceInputView<'a, T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, T: Copy + DeviceRepr> Copy for DeviceInputView<'a, T>

Source§

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

Source§

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

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

impl<T: DeviceRepr> DeviceRange<T> for DeviceInputView<'_, T>

Source§

fn as_device_ptr(&self) -> *const T

Returns the device input pointer without asserting that its values are initialized. Read more
Source§

fn len(&self) -> usize

Returns the number of input elements.
Source§

fn context(&self) -> &Arc<Context> ⓘ

Returns the context associated with the input allocation.
Source§

fn is_empty(&self) -> bool

Returns whether the input range contains no elements.
Source§

fn byte_len(&self) -> Result<usize>

Returns the input range length in bytes. Read more
Source§

impl<T: DeviceRepr> DeviceRegionProvider for DeviceInputView<'_, T>

Source§

fn region(&self) -> DeviceRegion<'_>

Borrows the exact allocation range described by this provider’s pointers.
Source§

impl<T: DeviceRepr> PushKernelArg for DeviceInputView<'_, T>

Source§

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

Appends this value in the kernel ABI representation selected by its implementation.
Source§

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

Source§

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

Appends this value in the kernel ABI representation selected by its implementation.

Auto Trait Implementations§

§

impl<'a, T> !RefUnwindSafe for DeviceInputView<'a, T>

§

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

§

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

§

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

§

impl<'a, T> Forget for DeviceInputView<'a, T>

§

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

§

impl<'a, T> Move for DeviceInputView<'a, T>

§

impl<'a, T> Unpin for DeviceInputView<'a, T>
where PhantomData<&'a MaybeUninit<T>>: Unpin,

§

impl<'a, T> UnsafeUnpin for DeviceInputView<'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<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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.