Struct rin::gl::Buffer [−][src]
pub struct Buffer<T> { /* fields omitted */ }
A mutable buffer object allocated with gl(Named)BufferData
Implementations
impl<T> Buffer<T> where
T: 'static,
[src]
impl<T> Buffer<T> where
T: 'static,
[src]pub fn load(&mut self, data: &[T], usage: u32)
[src]
Loads the passed data into the buffer (re)allocating it
see: gl(Named)BufferData
pub fn load_target(&mut self, data: &[T], usage: u32, target: u32)
[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: u32)
[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: u32, target: u32)
[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, Buffer<T>>, Error>
[src]
&mut self,
flags: MapReadFlags
) -> Result<MapRead<'_, T, Buffer<T>>, Error>
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, Buffer<T>>, Error>
[src]
&mut self,
flags: MapWriteFlags
) -> Result<MapWrite<'_, T, Buffer<T>>, Error>
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, Buffer<T>>, Error>
[src]
&mut self,
flags: MapReadWriteFlags
) -> Result<MapReadWrite<'_, T, Buffer<T>>, Error>
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], Error>
[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], Error>
[src]
&mut self,
flags: MapWriteFlags
) -> Result<&mut [T], Error>
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], Error>
[src]
&mut self,
flags: MapReadWriteFlags
) -> Result<&mut [T], Error>
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>(&self, dst: &mut B) where
B: BufferRange<U> + WithBackendMut,
[src]
B: BufferRange<U> + WithBackendMut,
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) -> u32
[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>(&self, range: R) -> Range<T, Buffer<T>, &Buffer<T>> where
R: InputRange,
[src]
R: InputRange,
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>(&mut self, range: R) -> Range<T, Buffer<T>, &mut Buffer<T>> where
R: InputRange,
[src]
R: InputRange,
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>(self, range: R) -> Range<T, Buffer<T>, Buffer<T>> where
R: InputRange,
[src]
R: InputRange,
Consumes the buffer into a range
Panics if the range is out of bounds
Trait Implementations
impl<'a, '_, T> BufferRange<T> for &'_ Buffer<T> where
T: 'static,
[src]
impl<'a, '_, T> BufferRange<T> for &'_ Buffer<T> where
T: 'static,
[src]impl<'a, T> BufferRange<T> for Buffer<T> where
T: 'static,
[src]
impl<'a, T> BufferRange<T> for Buffer<T> where
T: 'static,
[src]impl<'a, T> BufferRangeMut<T> for Buffer<T> where
T: 'static,
[src]
impl<'a, T> BufferRangeMut<T> for Buffer<T> where
T: 'static,
[src]impl<T> From<Buffer<T>> for SharedBuffer<T> where
T: 'static,
[src]
impl<T> From<Buffer<T>> for SharedBuffer<T> where
T: 'static,
[src]pub fn from(buffer: Buffer<T>) -> SharedBuffer<T>
[src]
impl<'a, T> MapRange<T> for Buffer<T>
[src]
impl<'a, T> MapRange<T> for Buffer<T>
[src]pub fn map_range_read(
&mut self,
offset: usize,
length: usize,
flags: MapReadFlags
) -> Result<MapRead<'_, T, Buffer<T>>, Error>
[src]
&mut self,
offset: usize,
length: usize,
flags: MapReadFlags
) -> Result<MapRead<'_, T, Buffer<T>>, Error>
impl<'a, T> MapRangeMut<T> for Buffer<T>
[src]
impl<'a, T> MapRangeMut<T> for Buffer<T>
[src]pub fn map_range_write(
&mut self,
offset: usize,
length: usize,
flags: MapWriteFlags
) -> Result<MapWrite<'_, T, Buffer<T>>, Error>
[src]
&mut self,
offset: usize,
length: usize,
flags: MapWriteFlags
) -> Result<MapWrite<'_, T, Buffer<T>>, Error>
pub fn map_range_read_write(
&mut self,
offset: usize,
length: usize,
flags: MapReadWriteFlags
) -> Result<MapReadWrite<'_, T, Buffer<T>>, Error>
[src]
&mut self,
offset: usize,
length: usize,
flags: MapReadWriteFlags
) -> Result<MapReadWrite<'_, T, Buffer<T>>, Error>
impl<'a, T> TypedBuffer<T> for Buffer<T> where
T: 'static,
[src]
impl<'a, T> TypedBuffer<T> for Buffer<T> where
T: 'static,
[src]pub fn id(&self) -> u32
[src]
pub fn len(&self) -> usize
[src]
pub fn capacity(&self) -> usize
[src]
pub fn with_map_read<F>(&self, flags: MapReadFlags, f: F) -> Result<(), Error> where
F: FnMut(&[T]),
[src]
F: FnMut(&[T]),
pub fn copy_to<U, BB>(&self, dst: &mut BB) where
BB: BufferRange<U> + WithBackendMut,
Buffer<T>: Sized,
[src]
BB: BufferRange<U> + WithBackendMut,
Buffer<T>: Sized,
pub unsafe fn unmap(&self)
[src]
pub fn is_empty(&self) -> bool
[src]
pub fn bytes(&self) -> usize
[src]
pub fn capacity_bytes(&self) -> usize
[src]
pub fn stride(&self) -> usize
[src]
impl<'a, '_, T> TypedBuffer<T> for &'_ Buffer<T> where
T: 'static,
[src]
impl<'a, '_, T> TypedBuffer<T> for &'_ Buffer<T> where
T: 'static,
[src]pub fn id(&self) -> u32
[src]
pub fn len(&self) -> usize
[src]
pub fn capacity(&self) -> usize
[src]
pub fn with_map_read<F>(&self, flags: MapReadFlags, f: F) -> Result<(), Error> where
F: FnMut(&[T]),
[src]
F: FnMut(&[T]),
pub fn copy_to<U, BB>(&self, dst: &mut BB) where
BB: BufferRange<U> + WithBackendMut,
&'_ Buffer<T>: Sized,
[src]
BB: BufferRange<U> + WithBackendMut,
&'_ Buffer<T>: Sized,
pub unsafe fn unmap(&self)
[src]
pub fn is_empty(&self) -> bool
[src]
pub fn bytes(&self) -> usize
[src]
pub fn capacity_bytes(&self) -> usize
[src]
pub fn stride(&self) -> usize
[src]
impl<'a, T> TypedBufferMut<T> for Buffer<T> where
T: 'static,
[src]
impl<'a, T> TypedBufferMut<T> for Buffer<T> where
T: 'static,
[src]pub unsafe fn with_map_write<F>(
&mut self,
flags: MapWriteFlags,
f: F
) -> Result<(), Error> where
F: Fn(&mut [T]),
[src]
&mut self,
flags: MapWriteFlags,
f: F
) -> Result<(), Error> where
F: Fn(&mut [T]),
pub fn with_map_read_write<F>(
&mut self,
flags: MapReadWriteFlags,
f: F
) -> Result<(), Error> where
F: Fn(&mut [T]),
[src]
&mut self,
flags: MapReadWriteFlags,
f: F
) -> Result<(), Error> where
F: Fn(&mut [T]),
impl<'a, T> WithBackend for Buffer<T>
[src]
impl<'a, T> WithBackend for Buffer<T>
[src]pub fn with_backend<F, R>(&self, f: F) -> R where
F: FnMut(&dyn Backend) -> R,
[src]
F: FnMut(&dyn Backend) -> R,
impl<'a, T> WithBackendMut for Buffer<T>
[src]
impl<'a, T> WithBackendMut for Buffer<T>
[src]pub fn with_backend_mut<F, R>(&mut self, f: F) -> R where
F: FnMut(&mut dyn Backend) -> R,
[src]
F: FnMut(&mut dyn Backend) -> R,
impl<'a, T> WithMapRange<T> for Buffer<T> where
T: 'static,
[src]
impl<'a, T> WithMapRange<T> for Buffer<T> where
T: 'static,
[src]pub fn with_map_range_read<F>(
&self,
offset: usize,
length: usize,
flags: MapReadFlags,
f: F
) -> Result<(), Error> where
F: FnMut(&[T]),
[src]
&self,
offset: usize,
length: usize,
flags: MapReadFlags,
f: F
) -> Result<(), Error> where
F: FnMut(&[T]),
impl<'a, T> WithMapRangeMut<T> for Buffer<T> where
T: 'static,
[src]
impl<'a, T> WithMapRangeMut<T> for Buffer<T> where
T: 'static,
[src]pub unsafe fn with_map_range_write<F>(
&mut self,
offset: usize,
length: usize,
flags: MapWriteFlags,
f: F
) -> Result<(), Error> where
F: FnMut(&mut [T]),
[src]
&mut self,
offset: usize,
length: usize,
flags: MapWriteFlags,
f: F
) -> Result<(), Error> where
F: FnMut(&mut [T]),
pub fn with_map_range_read_write<F>(
&mut self,
offset: usize,
length: usize,
flags: MapReadWriteFlags,
f: F
) -> Result<(), Error> where
F: FnMut(&mut [T]),
[src]
&mut self,
offset: usize,
length: usize,
flags: MapReadWriteFlags,
f: F
) -> Result<(), Error> where
F: FnMut(&mut [T]),
impl<T> BufferExt<T> for Buffer<T> where
T: 'static,
[src]
T: 'static,
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,
T: Unpin,
impl<T> !UnwindSafe for Buffer<T>
Blanket Implementations
impl<'a, B> AttributeBufferBinding for B where
B: BufferRange<u32> + ?Sized,
[src]
impl<'a, B> AttributeBufferBinding for B where
B: BufferRange<u32> + ?Sized,
[src]pub fn enable_for(
&self,
vao: &Vao,
gl: &mut State<'_>,
capabilities: &Capabilities
)
[src]
&self,
vao: &Vao,
gl: &mut State<'_>,
capabilities: &Capabilities
)
pub fn disable_for(
&self,
vao: &Vao,
gl: &mut State<'_>,
capabilities: &Capabilities
)
[src]
&self,
vao: &Vao,
gl: &mut State<'_>,
capabilities: &Capabilities
)
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<T, M> MapRange<T> for M where
M: WithMapRange<T>,
[src]
M: WithMapRange<T>,