Skip to main content

luaur_ast/methods/
temp_vector_t_operator_index.rs

1use crate::records::temp_vector::TempVector;
2
3impl<'a, T> TempVector<'a, T> {
4    pub fn operator_index(&self, index: usize) -> &T {
5        luaur_common::LUAU_ASSERT!(index < self.size_);
6        unsafe { &*(*self.storage).as_ptr().add(self.offset + index) }
7    }
8}
9
10impl<'a, T> core::ops::Index<usize> for TempVector<'a, T> {
11    type Output = T;
12
13    fn index(&self, index: usize) -> &Self::Output {
14        self.operator_index(index)
15    }
16}