Trait spirv_std::arch::IndexUnchecked
source · pub trait IndexUnchecked<T> {
unsafe fn index_unchecked(&self, index: usize) -> &T;
unsafe fn index_unchecked_mut(&mut self, index: usize) -> &mut T;
}
Expand description
Index into an array without bounds checking.
The main purpose of this trait is to work around the fact that the regular get_unchecked*
methods do not work in in SPIR-V.
Required Methods§
sourceunsafe fn index_unchecked(&self, index: usize) -> &T
unsafe fn index_unchecked(&self, index: usize) -> &T
Returns a reference to the element at index
. The equivalent of get_unchecked
.
Safety
Behavior is undefined if the index
value is greater than or equal to the length of the array.
sourceunsafe fn index_unchecked_mut(&mut self, index: usize) -> &mut T
unsafe fn index_unchecked_mut(&mut self, index: usize) -> &mut T
Returns a mutable reference to the element at index
. The equivalent of get_unchecked_mut
.
Safety
Behavior is undefined if the index
value is greater than or equal to the length of the array.