pub struct Buffer { /* private fields */ }Expand description
Implementations§
Source§impl Buffer
impl Buffer
Sourcepub fn new<T: Sized + Copy + 'static>(data: &[T]) -> Buffer
pub fn new<T: Sized + Copy + 'static>(data: &[T]) -> Buffer
Allocate a new Buffer in Linear memory and copy data into it.
Each element of data should correspond to data for a single vertex.
If you already have an owned [Vec] in Linear memory then
Buffer::new_in_linear should be preferred to take ownership
of that allocation instead of reallocating and copying.
Sourcepub fn new_with_stride(data: &[u8], stride: usize) -> Option<Buffer>
pub fn new_with_stride(data: &[u8], stride: usize) -> Option<Buffer>
Allocate a new Buffer in Linear memory and copy data into it.
The stride should correspond to the number of bytes in data
per single vertex.
If you already have an owned [Vec] in Linear memory then
Buffer::new_in_linear_with_stride should be preferred to take ownership
of that allocation instead of reallocating and copying.
§Errors
- If the length of
datais not a mutliple ofstride
Sourcepub fn new_in_linear<B: BufferData>(data: B) -> Buffer
pub fn new_in_linear<B: BufferData>(data: B) -> Buffer
Convert an existing buffer allocated in Linear memory to a Buffer to be used
with Info. Each element in data should correspond with data for
a single vertex.
Sourcepub fn new_in_linear_with_stride(
data: impl BufferData,
stride: usize,
) -> Option<Buffer>
pub fn new_in_linear_with_stride( data: impl BufferData, stride: usize, ) -> Option<Buffer>
pub fn as_ptr(&self) -> *const c_void
pub fn stride(&self) -> isize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Buffer
impl !RefUnwindSafe for Buffer
impl !Send for Buffer
impl !Sync for Buffer
impl Unpin for Buffer
impl !UnwindSafe for Buffer
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)