Skip to main content

DeviceOutputView

Struct DeviceOutputView 

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

An exclusive write-only range for a producer of T values.

The range may be uninitialized and cannot be used as a readable device slice. Its element type describes produced values rather than the storage’s current initialization state.

Implementations§

Source§

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

Source

pub fn into_region(self) -> DeviceRegion<'a>

Consumes the typed borrow into allocation metadata without granting access.

Source

pub unsafe fn from_raw_parts( region: DeviceRegion<'a>, length: usize, ) -> Result<Self>

Borrows an externally established writable region without claiming initialization.

§Safety

The region must remain live and exclusively writable for the returned lifetime, including queued CUDA accesses using this output.

§Errors

Returns an error if length * size_of::<T>() overflows or differs from the region’s byte length, or a nonempty region has a zero-sized element type or insufficient alignment.

Source

pub fn from_output<B: DeviceOutput<T> + ?Sized>(output: &'a mut B) -> Self

Borrows writable storage without exposing its existing contents as T values.

Source

pub fn reborrow(&mut self) -> DeviceOutputView<'_, T>

Borrows this destination again for a shorter exclusive lifetime.

Source

pub const fn len(&self) -> usize

Returns the number of output elements.

Source

pub const fn is_empty(&self) -> bool

Returns whether the output range is empty.

Source

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

Returns the pointer a producer may write through.

Source

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

Returns the output allocation’s context.

Source

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

Narrows this exclusive output borrow to an element range.

§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 split_at_mut(self, mid: usize) -> Result<(Self, Self)>

Splits this exclusive output borrow into disjoint writable ranges.

§Errors

Returns an error if mid exceeds the view’s element count.

Trait Implementations§

Source§

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

Source§

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

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

impl<T: DeviceRepr> DeviceOutput<T> for DeviceOutputView<'_, T>

Source§

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

Returns a pointer to the writable device output range. Read more
Source§

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

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 as_device_ptr(&self) -> *const T

Returns the device input pointer without asserting that its values are initialized. Read more
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 DeviceOutputView<'_, T>

Source§

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

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

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<'a, T> Freeze for DeviceOutputView<'a, T>
where PhantomData<&'a mut MaybeUninit<T>>: Freeze,

§

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

§

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

§

impl<'a, T> UnsafeUnpin for DeviceOutputView<'a, T>
where PhantomData<&'a mut MaybeUninit<T>>: UnsafeUnpin,

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> 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 = !

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.