Struct HostBuffer

Source
pub struct HostBuffer<T: Copy> {
    pub num_elements: usize,
    /* private fields */
}
Expand description

Synchronous implementation of crate::HostBuffer.

Refer to crate::HostBuffer for documentation.

Fields§

§num_elements: usize

Implementations§

Source§

impl<T: Copy> HostBuffer<T>

Source

pub fn new(num_elements: usize) -> Self

Source

pub fn from_slice(slice: &[T]) -> Self

Source

pub unsafe fn copy_from_async( &mut self, other: &DeviceBuffer<T>, stream: &Stream, ) -> Result<(), Error>

Copy from device buffer.

§Safety

This function is marked unsafe because it does not synchronize and the operation might not have completed when it returns.

Source

pub unsafe fn copy_to_async( &self, other: &mut DeviceBuffer<T>, stream: &Stream, ) -> Result<(), Error>

Copy to device buffer.

§Safety

This function is marked unsafe because it does not synchronize and the operation might not have completed when it returns.

Source

pub fn copy_from_slice(&mut self, slice: &[T])

Source

pub fn to_vec(&self) -> Vec<T>

Source

pub fn as_internal(&self) -> &DevicePtr

Get readonly reference to internal DevicePtr.

Source

pub fn as_mut_internal(&mut self) -> &mut DevicePtr

Get mutable reference to internal DevicePtr.

Source

pub unsafe fn free(&mut self)

Release the buffer memory.

§Panics

This function panics if binding to the corresponding device fails.

§Safety

The buffer may not be used after this function is called, except for being dropped.

Trait Implementations§

Source§

impl<T: Copy> Drop for HostBuffer<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T: Copy> Send for HostBuffer<T>

Implements Send for HostBuffer.

§Safety

This property is inherited from the CUDA API, which is thread-safe.

Source§

impl<T: Copy> Sync for HostBuffer<T>

Implements Sync for HostBuffer.

§Safety

This property is inherited from the CUDA API, which is thread-safe.

Auto Trait Implementations§

§

impl<T> Freeze for HostBuffer<T>

§

impl<T> RefUnwindSafe for HostBuffer<T>
where T: RefUnwindSafe,

§

impl<T> Unpin for HostBuffer<T>
where T: Unpin,

§

impl<T> UnwindSafe for HostBuffer<T>
where T: UnwindSafe,

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