pub trait BufferVec<T: BufferVecItem>:
Debug
+ Clone
+ From<Buffer>
+ Index<usize>
+ IndexMut<usize>
+ Index<Range<usize>>
+ IndexMut<Range<usize>>
+ Index<RangeTo<usize>>
+ IndexMut<RangeTo<usize>>
+ Index<RangeFull>
+ IndexMut<RangeFull>
+ Index<RangeInclusive<usize>>
+ IndexMut<RangeInclusive<usize>>
+ Index<RangeToInclusive<usize>>
+ IndexMut<RangeToInclusive<usize>> {
Show 16 methods
// Required methods
fn get_buffer(&self) -> &Buffer;
fn get_buffer_mut(&mut self) -> &mut Buffer;
fn get_target(&self) -> BufferTarget;
fn set_target(&mut self, target: BufferTarget);
fn len(&self) -> usize;
fn capacity(&self) -> usize;
fn resize(&mut self, new_len: usize, value: T) -> Result<(), GLCoreError>;
fn shrink_to_fit(&mut self) -> Result<(), GLCoreError>;
fn get(&self, index: usize) -> Result<T, GLCoreError>;
fn set(&mut self, index: usize, data: &T) -> Result<(), GLCoreError>;
fn get_slice_of_data(
&self,
start_index: usize,
len: usize,
) -> Result<Vec<T>, GLCoreError>;
fn set_slice_of_data(
&mut self,
start_index: usize,
data: &[T],
) -> Result<(), GLCoreError>;
// Provided methods
fn flush(&mut self) -> Result<(), GLCoreError> { ... }
fn is_empty(&self) -> bool { ... }
fn bind<'a>(&'a self) -> Result<BufferBind<'a>, GLCoreError> { ... }
fn bind_to<'a>(
&'a self,
target: BufferTarget,
) -> Result<BufferBind<'a>, GLCoreError> { ... }
}
Expand description
The BufferVec
trait
Required Methods§
Sourcefn get_buffer(&self) -> &Buffer
fn get_buffer(&self) -> &Buffer
Get the underlying Buffer
Sourcefn get_buffer_mut(&mut self) -> &mut Buffer
fn get_buffer_mut(&mut self) -> &mut Buffer
Get the underlying Buffer
as mut
Sourcefn get_target(&self) -> BufferTarget
fn get_target(&self) -> BufferTarget
Get the default binding target of the buffer
Sourcefn set_target(&mut self, target: BufferTarget)
fn set_target(&mut self, target: BufferTarget)
Set the binding target of the buffer
Sourcefn resize(&mut self, new_len: usize, value: T) -> Result<(), GLCoreError>
fn resize(&mut self, new_len: usize, value: T) -> Result<(), GLCoreError>
Resizes to the new size, reallocate the buffer if the new size is larger
Sourcefn shrink_to_fit(&mut self) -> Result<(), GLCoreError>
fn shrink_to_fit(&mut self) -> Result<(), GLCoreError>
Shrink to the exact number of items
Sourcefn get(&self, index: usize) -> Result<T, GLCoreError>
fn get(&self, index: usize) -> Result<T, GLCoreError>
Retrieve a single item from the buffer in the GPU
Sourcefn set(&mut self, index: usize, data: &T) -> Result<(), GLCoreError>
fn set(&mut self, index: usize, data: &T) -> Result<(), GLCoreError>
Update a single item from the buffer in the GPU
Sourcefn get_slice_of_data(
&self,
start_index: usize,
len: usize,
) -> Result<Vec<T>, GLCoreError>
fn get_slice_of_data( &self, start_index: usize, len: usize, ) -> Result<Vec<T>, GLCoreError>
Retrieve a slice of items from the buffer in the GPU
Sourcefn set_slice_of_data(
&mut self,
start_index: usize,
data: &[T],
) -> Result<(), GLCoreError>
fn set_slice_of_data( &mut self, start_index: usize, data: &[T], ) -> Result<(), GLCoreError>
Update a slice of itrems to the buffer in the GPU
Provided Methods§
Sourcefn flush(&mut self) -> Result<(), GLCoreError>
fn flush(&mut self) -> Result<(), GLCoreError>
Flush the buffer to the GPU if it has a cache in the system memory
Sourcefn bind<'a>(&'a self) -> Result<BufferBind<'a>, GLCoreError>
fn bind<'a>(&'a self) -> Result<BufferBind<'a>, GLCoreError>
Create a BufferBind
to use the RAII system to manage the binding state.
Sourcefn bind_to<'a>(
&'a self,
target: BufferTarget,
) -> Result<BufferBind<'a>, GLCoreError>
fn bind_to<'a>( &'a self, target: BufferTarget, ) -> Result<BufferBind<'a>, GLCoreError>
Bind to a specific target. WILL NOT change the default target of the buffer. Create a BufferBind
to use the RAII system to manage the binding state, while change the binding target.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.