Struct glin::Buffer[][src]

pub struct Buffer<T> { /* fields omitted */ }

A mutable buffer object allocated with gl(Named)BufferData

Implementations

impl<T: 'static> Buffer<T>[src]

pub fn load(&mut self, data: &[T], usage: GLenum)[src]

Loads the passed data into the buffer (re)allocating it

see: gl(Named)BufferData

pub fn load_target(&mut self, data: &[T], usage: GLenum, target: GLenum)[src]

Loads the passed data into the buffer (re)allocating it to an specific target

see: gl(Named)BufferData

pub fn reserve(&mut self, len: usize, usage: GLenum)[src]

Reserves len amount of memory into the buffer (re)allocating it

see: gl(Named)BufferData

pub fn reserve_target(&mut self, len: usize, usage: GLenum, target: GLenum)[src]

Reserves len amount of memory into the buffer (re)allocating it to an specific target

see: gl(Named)BufferData

pub fn update(&mut self, data: &[T])[src]

Loads the passed data at the beginning of the buffer

Will panic if the buffer is not big enough or not allocated at all

see: gl(Named)BufferSubData

pub fn map_read(&mut self, flags: MapReadFlags) -> Result<MapRead<'_, T, Self>>[src]

Maps a buffer object’s data store

Pass a closure that receives the mapped buffer to access it

see glMapBuffer

pub fn map_write(
    &mut self,
    flags: MapWriteFlags
) -> Result<MapWrite<'_, T, Self>>
[src]

Maps a buffer object’s data store

Pass a closure that receives the mapped buffer to access it

see glMapBuffer

pub fn map_read_write(
    &mut self,
    flags: MapReadWriteFlags
) -> Result<MapReadWrite<'_, T, Self>>
[src]

Maps a buffer object’s data store

Pass a closure that receives the mapped buffer to access it

see glMapBuffer

pub unsafe fn map_read_slice(&self, flags: MapReadFlags) -> Result<&[T]>[src]

Maps a buffer object’s data store as a slice

This operation is unsafe cause the buffer needs to be unmapped manually so it could be accessed while mapped which is undefined behaviour

see glMapBuffer

pub unsafe fn map_write_slice(
    &mut self,
    flags: MapWriteFlags
) -> Result<&mut [T]>
[src]

Maps a buffer object’s data store as a slice

This operation is unsafe cause the buffer needs to be unmapped manually so it could be accessed while mapped which is undefined behaviour

see glMapBuffer

pub unsafe fn map_read_write_slice(
    &mut self,
    flags: MapReadWriteFlags
) -> Result<&mut [T]>
[src]

Maps a buffer object’s data store as a slice

This operation is unsafe cause the buffer needs to be unmapped manually so it could be accessed while mapped which is undefined behaviour

see glMapBuffer

pub unsafe fn unmap(&mut self)[src]

pub fn copy_to<U, B: BufferRange<U> + WithBackendMut>(&self, dst: &mut B)[src]

Copy one buffer into another

pub fn len(&self) -> usize[src]

Number of elements on the last update

pub fn is_empty(&self) -> bool[src]

If there’s no elements loaded in the buffer

This is len == 0 not capacity == 0

pub fn capacity(&self) -> usize[src]

Allocated capacity of the buffer in number of elements

pub fn bytes(&self) -> usize[src]

Total bytes on the last update

pub fn capacity_bytes(&self) -> usize[src]

Total capcacity of the buffer in bytes

pub fn id(&self) -> GLuint[src]

OpenGL id

pub fn stride(&self) -> usize[src]

Stride of the buffer type

pub fn into_shared(self) -> SharedBuffer<T>[src]

Consume into a shared buffer

pub fn range<R: InputRange>(&self, range: R) -> Range<T, Buffer<T>, &Buffer<T>>[src]

Get a range from the buffer

Useful to do operations on portions of the buffer

Panics if the range is out of bounds

pub fn range_mut<R: InputRange>(
    &mut self,
    range: R
) -> Range<T, Buffer<T>, &mut Buffer<T>>
[src]

Get a mutable range from the buffer

Useful to do operations on portions of the buffer

Panics if the range is out of bounds

pub fn into_range<R: InputRange>(
    self,
    range: R
) -> Range<T, Buffer<T>, Buffer<T>>
[src]

Consumes the buffer into a range

Panics if the range is out of bounds

impl Buffer<u8>[src]

pub fn cast<T>(self) -> Buffer<T>[src]

Trait Implementations

impl<'a, T: 'static> BufferRange<T> for Buffer<T>[src]

impl<'a, T: 'static> BufferRange<T> for &Buffer<T>[src]

impl<'a, T: 'static> BufferRangeMut<T> for Buffer<T>[src]

impl<T> Cast<T> for Buffer<u8>[src]

type CastTo = Buffer<T>

impl<T: Debug> Debug for Buffer<T>[src]

impl<T: 'static> From<Buffer<T>> for SharedBuffer<T>[src]

impl<'a, T> MapRange<T> for Buffer<T>[src]

impl<'a, T> MapRangeMut<T> for Buffer<T>[src]

impl<T> PartialEq<Buffer<T>> for Buffer<T>[src]

impl<'a, T: 'static> TypedBuffer<T> for Buffer<T>[src]

impl<'a, T: 'static> TypedBuffer<T> for &Buffer<T>[src]

impl<'a, T: 'static> TypedBufferMut<T> for Buffer<T>[src]

impl<'a, T> WithBackend for Buffer<T>[src]

impl<'a, T> WithBackendMut for Buffer<T>[src]

impl<'a, T: 'static> WithMapRange<T> for Buffer<T>[src]

impl<'a, T: 'static> WithMapRangeMut<T> for Buffer<T>[src]

impl<T> Eq for Buffer<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Buffer<T>

impl<T> !Send for Buffer<T>

impl<T> !Sync for Buffer<T>

impl<T> Unpin for Buffer<T> where
    T: Unpin

impl<T> !UnwindSafe for Buffer<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any
[src]

impl<'a, B> AttributeBufferBinding for B where
    B: BufferRange<u32> + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.