Skip to main content

DeviceArrayView

Struct DeviceArrayView 

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

A non-owning view into device (GPU) memory with compile-time element type T.

The lifetime parameter 'a ties this view to whatever owns the underlying memory (a DeviceArray, a result object, etc.), preventing use-after-free.

Implementations§

Source§

impl<'a, T: CugraphElement> DeviceArrayView<'a, T>

Source

pub fn device_ptr(&self) -> *mut c_void

Device pointer to the first element of this view.

Source

pub fn len(&self) -> usize

Number of elements in this view.

Source

pub fn is_empty(&self) -> bool

Whether this view is empty.

Source

pub fn to_vec(&self, handle: &EnteredContext<'_>) -> Result<Vec<T>>

Copy device array data to a typed host vector.

§Example
let arr = DeviceArray::from_slice(&entered, &[10i32, 20, 30]).unwrap();
let values: Vec<i32> = arr.view().unwrap().to_vec(&entered).unwrap();
assert_eq!(values, vec![10, 20, 30]);

Trait Implementations§

Source§

impl<T: CugraphElement> Debug for DeviceArrayView<'_, T>

Source§

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

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

impl<'a, V: CugraphElement> From<&'a DeviceArrayView<'a, V>> for VertexSelection<'a, V>

Source§

fn from(view: &'a DeviceArrayView<'a, V>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

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

§

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

§

impl<'a, T> Freeze for DeviceArrayView<'a, T>
where PhantomData<T>: Freeze,

§

impl<'a, T> RefUnwindSafe for DeviceArrayView<'a, T>

§

impl<'a, T> Unpin for DeviceArrayView<'a, T>
where PhantomData<T>: Unpin,

§

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

§

impl<'a, T> UnwindSafe for DeviceArrayView<'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<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, 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.