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>
impl<'a, T: DeviceRepr> DeviceInputView<'a, T>
Sourcepub fn create(region: DeviceRegion<'a>) -> Result<Self>
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.
Sourcepub fn from_buffer<B: DeviceRange<T> + ?Sized>(buffer: &'a B) -> Self
pub fn from_buffer<B: DeviceRange<T> + ?Sized>(buffer: &'a B) -> Self
Borrows typed input metadata without strengthening its validity contract.
Sourcepub fn as_ptr(&self) -> *const T
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.
Sourcepub fn context(&self) -> &'a Arc<Context> ⓘ
pub fn context(&self) -> &'a Arc<Context> ⓘ
Returns the context associated with the viewed allocation.
Sourcepub const fn region(&self) -> DeviceRegion<'a>
pub const fn region(&self) -> DeviceRegion<'a>
Returns the view’s exact byte range and allocation identity.
Sourcepub fn slice<R: RangeBounds<usize>>(self, range: R) -> Result<Self>
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.
Sourcepub fn cast<U: DeviceRepr>(self) -> Result<DeviceInputView<'a, U>>
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.