Struct luminance::buffer::Buffer
[−]
[src]
pub struct Buffer<T> { /* fields omitted */ }
A Buffer
is a GPU region you can picture as an array. It has a static size and cannot be
resized. The size is expressed in number of elements lying in the buffer, not in bytes.
Methods
impl<T> Buffer<T>
[src]
fn new(len: usize) -> Buffer<T>
[src]
Create a new Buffer
with a given number of elements.
fn len(&self) -> usize
[src]
Get the length of the buffer.
fn at(&self, i: usize) -> Option<T> where
T: Copy,
[src]
T: Copy,
Retrieve an element from the Buffer
.
Checks boundaries.
fn whole(&self) -> Vec<T> where
T: Copy,
[src]
T: Copy,
Retrieve the whole content of the Buffer
.
fn set(&mut self, i: usize, x: T) -> Result<(), BufferError> where
T: Copy,
[src]
T: Copy,
Set a value at a given index in the Buffer
.
Checks boundaries.
fn write_whole(&self, values: &[T]) -> Result<(), BufferError>
[src]
Write a whole slice into a buffer.
If the slice you pass in as less items than the length of the buffer, you’ll get a
BufferError::TooFewValues
. If it has more, you’ll get BufferError::TooManyValues
.
In all cases, the copy will be performed and clamped to reasonable length.
fn clear(&self, x: T) where
T: Copy,
[src]
T: Copy,
Fill the Buffer
with a single value.
fn fill(&self, values: &[T])
[src]
Fill the whole buffer with an array.
fn to_raw(self) -> RawBuffer
[src]
Convert a buffer to its raw representation.
fn as_slice(&self) -> Result<BufferSlice<T>, BufferError>
[src]
Obtain an immutable slice view into the buffer.
fn as_slice_mut(&mut self) -> Result<BufferSliceMut<T>, BufferError>
[src]
Obtain a mutable slice view into the buffer.
Methods from Deref<Target = RawBuffer>
fn as_slice<T>(&self) -> Result<BufferSlice<T>, BufferError>
[src]
Obtain an immutable slice view into the buffer.
fn as_slice_mut<T>(&mut self) -> Result<BufferSliceMut<T>, BufferError>
[src]
Obtain a mutable slice view into the buffer.
Trait Implementations
impl<T: Debug> Debug for Buffer<T>
[src]
impl<T: Eq> Eq for Buffer<T>
[src]
impl<T: PartialEq> PartialEq for Buffer<T>
[src]
fn eq(&self, __arg_0: &Buffer<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Buffer<T>) -> bool
[src]
This method tests for !=
.
impl<T> Deref for Buffer<T>
[src]
type Target = RawBuffer
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
Dereferences the value.