pub struct BufferDescriptor {
pub size: usize,
pub usage: BufferUsage,
pub location: MemoryLocation,
pub dtype: Option<DType>,
pub shape: Option<Shape>,
pub initial_data: Option<Vec<u8>>,
pub alignment: Option<usize>,
pub zero_init: bool,
}Expand description
Buffer descriptor for creation
Fields§
§size: usizeBuffer size in bytes
usage: BufferUsageBuffer usage flags
location: MemoryLocationMemory location hint
dtype: Option<DType>Data type stored in buffer (for type safety)
shape: Option<Shape>Shape of data in buffer (for tensor operations)
initial_data: Option<Vec<u8>>Initial data to copy to buffer
alignment: Option<usize>Memory alignment requirement
zero_init: boolWhether buffer should be zero-initialized
Implementations§
Source§impl BufferDescriptor
impl BufferDescriptor
Sourcepub fn new(size: usize, usage: BufferUsage) -> Self
pub fn new(size: usize, usage: BufferUsage) -> Self
Create a new buffer descriptor
Sourcepub fn with_location(self, location: MemoryLocation) -> Self
pub fn with_location(self, location: MemoryLocation) -> Self
Set memory location
Sourcepub fn with_dtype(self, dtype: DType) -> Self
pub fn with_dtype(self, dtype: DType) -> Self
Set data type
Sourcepub fn with_shape(self, shape: Shape) -> Self
pub fn with_shape(self, shape: Shape) -> Self
Set shape
Sourcepub fn with_initial_data(self, data: Vec<u8>) -> Self
pub fn with_initial_data(self, data: Vec<u8>) -> Self
Set initial data
Sourcepub fn with_alignment(self, alignment: usize) -> Self
pub fn with_alignment(self, alignment: usize) -> Self
Set alignment requirement
Sourcepub fn with_zero_init(self) -> Self
pub fn with_zero_init(self) -> Self
Enable zero initialization
Trait Implementations§
Source§impl Clone for BufferDescriptor
impl Clone for BufferDescriptor
Source§fn clone(&self) -> BufferDescriptor
fn clone(&self) -> BufferDescriptor
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 moreSource§impl Debug for BufferDescriptor
impl Debug for BufferDescriptor
Source§impl PartialEq for BufferDescriptor
impl PartialEq for BufferDescriptor
impl StructuralPartialEq for BufferDescriptor
Auto Trait Implementations§
impl !Freeze for BufferDescriptor
impl RefUnwindSafe for BufferDescriptor
impl Send for BufferDescriptor
impl Sync for BufferDescriptor
impl Unpin for BufferDescriptor
impl UnsafeUnpin for BufferDescriptor
impl UnwindSafe for BufferDescriptor
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more