pub trait ByteBuffer {
// Required methods
fn byte_length(&self) -> usize;
fn borrow_bytes(&self) -> &[u8] ⓘ;
fn as_u8_ptr(&self) -> *const u8;
}
Expand description
A trait for all types that are to be used as sources of data for buffers of, e.g. vertex data, indices, etc
The data is viewed by OpenGL as a pointer and byte length; these methods provide access to the data in that way.
These methods are all safe - any use of the information they provide may be unsafe.
Required Methods§
Sourcefn byte_length(&self) -> usize
fn byte_length(&self) -> usize
Get the length of the data buffer in bytes
Sourcefn borrow_bytes(&self) -> &[u8] ⓘ
fn borrow_bytes(&self) -> &[u8] ⓘ
Borrow the data as an array of bytes
Implementations on Foreign Types§
Source§impl<T> ByteBuffer for &[T]
Implement ByteBuffer for &[T]
impl<T> ByteBuffer for &[T]
Implement ByteBuffer for &[T]
Source§impl<T> ByteBuffer for Vec<T>
Implement ByteBuffer for Vec
impl<T> ByteBuffer for Vec<T>
Implement ByteBuffer for Vec
Source§impl<T, const N: usize> ByteBuffer for [T; N]
Implement ByteBuffer for slice of T
impl<T, const N: usize> ByteBuffer for [T; N]
Implement ByteBuffer for slice of T