Struct DeviceBuffer

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

Synchronous implementation of crate::DeviceBuffer.

Refer to crate::DeviceBuffer for documentation.

Fields§

§num_elements: usize

Implementations§

Source§

impl<T: Copy> DeviceBuffer<T>

Source

pub fn new(num_elements: usize, stream: &Stream) -> Self

Source

pub fn from_slice(slice: &[T], stream: &Stream) -> Result<Self, Error>

Source

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

Copy from host 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 HostBuffer<T>, stream: &Stream, ) -> Result<(), Error>

Copy to host 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 fill_with_byte( &mut self, value: u8, stream: &Stream, ) -> Result<(), Error>

Fill buffer with byte value.

Source

pub fn as_internal(&self) -> &DevicePtr

Get readonly reference to internal DevicePtr.

Source

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

Get readonly reference to internal DevicePtr.

Trait Implementations§

Source§

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

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

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

Implements Send for DeviceBuffer.

§Safety

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

Source§

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

Implements Sync for DeviceBuffer.

§Safety

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

Auto Trait Implementations§

§

impl<T> Freeze for DeviceBuffer<T>

§

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

§

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

§

impl<T> UnwindSafe for DeviceBuffer<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.