pub struct DeviceBuffer {
pub data: Vec<u8>,
pub count: usize,
pub element_type: ElementType,
}Expand description
CPU-side buffer representing device memory.
Fields§
§data: Vec<u8>Raw bytes of the buffer.
count: usizeNumber of elements in the buffer.
element_type: ElementTypeElement data type.
Implementations§
Source§impl DeviceBuffer
impl DeviceBuffer
Sourcepub fn to_f32(&self) -> Result<Vec<f32>, RuntimeError>
pub fn to_f32(&self) -> Result<Vec<f32>, RuntimeError>
Read buffer contents as f32 values.
§Errors
Returns RuntimeError::Memory if the buffer element type is not f32.
Sourcepub fn to_u32(&self) -> Result<Vec<u32>, RuntimeError>
pub fn to_u32(&self) -> Result<Vec<u32>, RuntimeError>
Read buffer contents as u32 values.
§Errors
Returns RuntimeError::Memory if the buffer element type is not u32.
Sourcepub fn size_bytes(&self) -> usize
pub fn size_bytes(&self) -> usize
Total size of the buffer in bytes.
Trait Implementations§
Source§impl Clone for DeviceBuffer
impl Clone for DeviceBuffer
Source§fn clone(&self) -> DeviceBuffer
fn clone(&self) -> DeviceBuffer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DeviceBuffer
impl RefUnwindSafe for DeviceBuffer
impl Send for DeviceBuffer
impl Sync for DeviceBuffer
impl Unpin for DeviceBuffer
impl UnsafeUnpin for DeviceBuffer
impl UnwindSafe for DeviceBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more