orx_concurrent_vec/common_traits/
index.rs1use crate::{ConcurrentSlice, ConcurrentVec, elem::ConcurrentElement};
2use core::ops::Index;
3use orx_pinned_vec::IntoConcurrentPinnedVec;
4
5impl<P, T> Index<usize> for ConcurrentVec<T, P>
8where
9 P: IntoConcurrentPinnedVec<ConcurrentElement<T>>,
10{
11 type Output = ConcurrentElement<T>;
12
13 fn index(&self, i: usize) -> &Self::Output {
21 self.get(i).expect("out-of-bounds")
22 }
23}
24
25impl<P, T> Index<usize> for ConcurrentSlice<'_, T, P>
28where
29 P: IntoConcurrentPinnedVec<ConcurrentElement<T>>,
30{
31 type Output = ConcurrentElement<T>;
32
33 fn index(&self, i: usize) -> &Self::Output {
41 self.get(i).expect("out-of-bounds")
42 }
43}