Struct DeviceBuffer2D

Source
pub struct DeviceBuffer2D<T: Copy> {
    pub width: usize,
    pub height: usize,
    pub num_channels: usize,
    pub pitch: usize,
    /* private fields */
}
Expand description

Synchronous implementation of crate::DeviceBuffer2D.

Refer to crate::DeviceBuffer2D for documentation.

Fields§

§width: usize§height: usize§num_channels: usize§pitch: usize

Implementations§

Source§

impl<T: Copy> DeviceBuffer2D<T>

Source

pub fn new(width: usize, height: usize, num_channels: usize) -> Self

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 num_elements(&self) -> usize

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 DeviceBuffer2D<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

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

Implements Send for DeviceBuffer2D.

§Safety

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

Source§

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

Implements Sync for DeviceBuffer2D.

§Safety

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

Auto Trait Implementations§

§

impl<T> Freeze for DeviceBuffer2D<T>

§

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

§

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

§

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