Struct vulkano::buffer::BufferSlice
[−]
[src]
pub struct BufferSlice<'a, T: ?Sized, B: 'a> { /* fields omitted */ }
A subpart of a buffer.
This object doesn't correspond to any Vulkan object. It exists for API convenience.
Example
Creating a slice:
use vulkano::buffer::BufferSlice; unsafe { std::mem::uninitialized() }; let _slice = BufferSlice::from(&buffer);
Selecting a slice of a buffer that contains [T]
:
use vulkano::buffer::BufferSlice; unsafe { std::mem::uninitialized() }; let _slice = BufferSlice::from(&buffer).slice(12 .. 14).unwrap();
Methods
impl<'a, T: ?Sized, B: 'a> BufferSlice<'a, T, B>
[src]
fn buffer(&self) -> &'a Arc<B>
Returns the buffer that this slice belongs to.
fn offset(&self) -> usize
Returns the offset of that slice within the buffer.
fn size(&self) -> usize
Returns the size of that slice in bytes.
unsafe fn slice_custom<F, R: ?Sized>(self, f: F) -> BufferSlice<'a, R, B> where F: for<'r> FnOnce(&'r T) -> &'r R
Builds a slice that contains an element from inside the buffer.
This method builds an object that represents a slice of the buffer. No actual operation is performed.
Example
TODO
Safety
The object whose reference is passed to the closure is uninitialized. Therefore you must not access the content of the object.
You must return a reference to an element from the parameter. The closure must not panic.
impl<'a, T, B: 'a> BufferSlice<'a, [T], B>
[src]
fn len(&self) -> usize
Returns the number of elements in this slice.
fn index(self, index: usize) -> Option<BufferSlice<'a, T, B>>
Reduces the slice to just one element of the array.
Returns None
if out of range.
fn slice(self, range: Range<usize>) -> Option<BufferSlice<'a, [T], B>>
Reduces the slice to just a range of the array.
Returns None
if out of range.
Trait Implementations
impl<'a, T: Clone + ?Sized, B: Clone + 'a> Clone for BufferSlice<'a, T, B>
[src]
fn clone(&self) -> BufferSlice<'a, T, B>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'a, T: ?Sized, B: 'a> From<&'a Arc<B>> for BufferSlice<'a, T, B> where B: TypedBuffer<Content=T>,
T: 'static
[src]
T: 'static
fn from(r: &'a Arc<B>) -> BufferSlice<'a, T, B>
Performs the conversion.
impl<'a, T, B: 'a> From<BufferSlice<'a, T, B>> for BufferSlice<'a, [T], B> where T: 'static
[src]
fn from(r: BufferSlice<'a, T, B>) -> BufferSlice<'a, [T], B>
Performs the conversion.