[−][src]Struct vulkano::buffer::BufferSlice
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; let _slice = BufferSlice::from(&buffer);
Selecting a slice of a buffer that contains [T]
:
use vulkano::buffer::BufferSlice; let _slice = BufferSlice::from(&buffer).slice(12 .. 14).unwrap();
Methods
impl<T: ?Sized, B> BufferSlice<T, B>
[src]
pub fn from_typed_buffer_access(r: B) -> BufferSlice<T, B> where
B: TypedBufferAccess<Content = T>,
[src]
B: TypedBufferAccess<Content = T>,
pub fn buffer(&self) -> &B
[src]
Returns the buffer that this slice belongs to.
pub fn offset(&self) -> usize
[src]
Returns the offset of that slice within the buffer.
pub fn size(&self) -> usize
[src]
Returns the size of that slice in bytes.
pub unsafe fn slice_custom<F, R: ?Sized>(self, f: F) -> BufferSlice<R, B> where
F: for<'r> FnOnce(&'r T) -> &'r R,
[src]
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.
pub unsafe fn reinterpret<R: ?Sized>(self) -> BufferSlice<R, B>
[src]
Changes the T
generic parameter of the BufferSlice
to the desired type. This can be
useful when you have a buffer with various types of data and want to create a typed slice
of a region that contains a single type of data.
Example
let blob_slice: BufferSlice<[u8], Arc<ImmutableBuffer<[u8]>>> = return; let vertex_slice: BufferSlice<[VertexImpl], Arc<ImmutableBuffer<[u8]>>> = unsafe { blob_slice.reinterpret::<[VertexImpl]>() };
Safety
Correct offset
and size
must be ensured before using this BufferSlice
on the device.
See BufferSlice::slice
for adjusting these properties.
impl<T, B> BufferSlice<[T], B>
[src]
pub fn len(&self) -> usize
[src]
Returns the number of elements in this slice.
pub fn index(self, index: usize) -> Option<BufferSlice<T, B>>
[src]
Reduces the slice to just one element of the array.
Returns None
if out of range.
pub fn slice(self, range: Range<usize>) -> Option<BufferSlice<[T], B>>
[src]
Reduces the slice to just a range of the array.
Returns None
if out of range.
Trait Implementations
impl<T: ?Sized, B> BufferAccess for BufferSlice<T, B> where
B: BufferAccess,
[src]
B: BufferAccess,
fn inner(&self) -> BufferInner
[src]
fn size(&self) -> usize
[src]
fn conflicts_buffer(&self, other: &dyn BufferAccess) -> bool
[src]
fn conflicts_image(&self, other: &dyn ImageAccess) -> bool
[src]
fn conflict_key(&self) -> (u64, usize)
[src]
fn try_gpu_lock(
&self,
exclusive_access: bool,
queue: &Queue
) -> Result<(), AccessError>
[src]
&self,
exclusive_access: bool,
queue: &Queue
) -> Result<(), AccessError>
unsafe fn increase_gpu_lock(&self)
[src]
unsafe fn unlock(&self)
[src]
fn as_buffer_slice(&self) -> BufferSlice<Self::Content, &Self> where
Self: Sized + TypedBufferAccess,
[src]
Self: Sized + TypedBufferAccess,
fn slice<T>(&self, range: Range<usize>) -> Option<BufferSlice<[T], &Self>> where
Self: Sized + TypedBufferAccess<Content = [T]>,
[src]
Self: Sized + TypedBufferAccess<Content = [T]>,
fn into_buffer_slice(self) -> BufferSlice<Self::Content, Self> where
Self: Sized + TypedBufferAccess,
[src]
Self: Sized + TypedBufferAccess,
fn index<T>(&self, index: usize) -> Option<BufferSlice<[T], &Self>> where
Self: Sized + TypedBufferAccess<Content = [T]>,
[src]
Self: Sized + TypedBufferAccess<Content = [T]>,
impl<T: ?Sized, B> TypedBufferAccess for BufferSlice<T, B> where
B: BufferAccess,
[src]
B: BufferAccess,
impl<T: ?Sized, B> DeviceOwned for BufferSlice<T, B> where
B: DeviceOwned,
[src]
B: DeviceOwned,
impl<T: ?Sized, B> Clone for BufferSlice<T, B> where
B: Clone,
[src]
B: Clone,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T, B> From<BufferSlice<T, B>> for BufferSlice<[T], B>
[src]
fn from(r: BufferSlice<T, B>) -> BufferSlice<[T], B>
[src]
Auto Trait Implementations
impl<T: ?Sized, B> Send for BufferSlice<T, B> where
B: Send,
T: Send,
B: Send,
T: Send,
impl<T: ?Sized, B> Unpin for BufferSlice<T, B> where
B: Unpin,
T: Unpin,
B: Unpin,
T: Unpin,
impl<T: ?Sized, B> Sync for BufferSlice<T, B> where
B: Sync,
T: Sync,
B: Sync,
T: Sync,
impl<T: ?Sized, B> UnwindSafe for BufferSlice<T, B> where
B: UnwindSafe,
T: UnwindSafe,
B: UnwindSafe,
T: UnwindSafe,
impl<T: ?Sized, B> RefUnwindSafe for BufferSlice<T, B> where
B: RefUnwindSafe,
T: RefUnwindSafe,
B: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> DeviceOwned for T where
T: Deref,
<T as Deref>::Target: DeviceOwned,
[src]
T: Deref,
<T as Deref>::Target: DeviceOwned,
impl<T> Content for T
[src]
fn ref_from_ptr(*mut c_void, usize) -> Option<*mut T>
[src]
fn is_size_suitable(usize) -> bool
[src]
fn indiv_size() -> usize
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,