#[repr(C)]pub struct RuntimeArray<T> { /* private fields */ }
Expand description
SPIR-V “runtime array”, similar to [T]
, but with no way of knowing its length.
Dynamically-sized arrays in Rust carry around their length as the second half of a tuple. Unfortunately, sometimes SPIR-V provides an unsized array with no way of obtaining its length.
Implementations§
Source§impl<T> RuntimeArray<T>
impl<T> RuntimeArray<T>
Sourcepub unsafe fn index(&self, index: usize) -> &T
pub unsafe fn index(&self, index: usize) -> &T
Index the array. Unfortunately, because the length of the runtime array cannot be known, this function will happily index outside of the bounds of the array, and so is unsafe.
§Safety
Bounds checking is not performed, and indexing outside the bounds of the array can happen, and lead to UB.
Sourcepub unsafe fn index_mut(&mut self, index: usize) -> &mut T
pub unsafe fn index_mut(&mut self, index: usize) -> &mut T
Index the array, returning a mutable reference to an element. Unfortunately, because the length of the runtime array cannot be known, this function will happily index outside of the bounds of the array, and so is unsafe.
§Safety
Bounds checking is not performed, and indexing outside the bounds of the array can happen, and lead to UB.