Trait ByteBuffer

Source
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§

Source

fn byte_length(&self) -> usize

Get the length of the data buffer in bytes

Source

fn borrow_bytes(&self) -> &[u8]

Borrow the data as an array of bytes

Source

fn as_u8_ptr(&self) -> *const u8

Return a pointer to the first byte of the data contents

Implementations on Foreign Types§

Source§

impl<T> ByteBuffer for &[T]

Implement ByteBuffer for &[T]

Source§

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

Implementors§