1use super::Array;
7
8use core::ops::{
10 Index,
11 IndexMut,
12 Range,
13 RangeFrom,
14 RangeFull,
15 RangeInclusive,
16 RangeTo,
17 RangeToInclusive
18};
19
20
21const impl<Type, const N: usize> Index<usize> for Array<Type, N> {
27 type Output = Type;
28 #[inline]
29 fn index(&self, index: usize) -> &Self::Output {self.get(index).unwrap()}
30}
31
32const impl<Type, const N: usize> IndexMut<usize> for Array<Type, N> {
34 #[inline]
35 fn index_mut(&mut self, index: usize) -> &mut Self::Output {self.get_mut(index).unwrap()}
36}
37
38
39const impl<Type, const N: usize> Index<Range<usize>> for Array<Type, N> {
45 type Output = [Type];
46 #[inline]
47 fn index(&self, index: Range<usize>) -> &Self::Output {self.as_ref().index(index)}
48}
49
50const impl<Type, const N: usize> IndexMut<Range<usize>> for Array<Type, N> {
52 #[inline]
53 fn index_mut(&mut self, index: Range<usize>) -> &mut Self::Output {self.as_mut().index_mut(index)}
54}
55
56
57const impl<Type, const N: usize> Index<RangeFrom<usize>> for Array<Type, N> {
63 type Output = [Type];
64 #[inline]
65 fn index(&self, index: RangeFrom<usize>) -> &Self::Output {self.as_ref().index(index)}
66}
67
68const impl<Type, const N: usize> IndexMut<RangeFrom<usize>> for Array<Type, N> {
70 #[inline]
71 fn index_mut(&mut self, index: RangeFrom<usize>) -> &mut Self::Output {self.as_mut().index_mut(index)}
72}
73
74
75const impl<Type, const N: usize> Index<RangeFull> for Array<Type, N> {
81 type Output = [Type];
82 #[inline]
83 fn index(&self, index: RangeFull) -> &Self::Output {self.as_ref().index(index)}
84}
85
86const impl<Type, const N: usize> IndexMut<RangeFull> for Array<Type, N> {
88 #[inline]
89 fn index_mut(&mut self, index: RangeFull) -> &mut Self::Output {self.as_mut().index_mut(index)}
90}
91
92
93const impl<Type, const N: usize> Index<RangeInclusive<usize>> for Array<Type, N> {
99 type Output = [Type];
100 #[inline]
101 fn index(&self, index: RangeInclusive<usize>) -> &Self::Output {self.as_ref().index(index)}
102}
103
104const impl<Type, const N: usize> IndexMut<RangeInclusive<usize>> for Array<Type, N> {
106 #[inline]
107 fn index_mut(&mut self, index: RangeInclusive<usize>) -> &mut Self::Output {self.as_mut().index_mut(index)}
108}
109
110
111const impl<Type, const N: usize> Index<RangeTo<usize>> for Array<Type, N> {
117 type Output = [Type];
118 #[inline]
119 fn index(&self, index: RangeTo<usize>) -> &Self::Output {self.as_ref().index(index)}
120}
121
122const impl<Type, const N: usize> IndexMut<RangeTo<usize>> for Array<Type, N> {
124 #[inline]
125 fn index_mut(&mut self, index: RangeTo<usize>) -> &mut Self::Output {self.as_mut().index_mut(index)}
126}
127
128
129const impl<Type, const N: usize> Index<RangeToInclusive<usize>> for Array<Type, N> {
135 type Output = [Type];
136 #[inline]
137 fn index(&self, index: RangeToInclusive<usize>) -> &Self::Output {self.as_ref().index(index)}
138}
139
140const impl<Type, const N: usize> IndexMut<RangeToInclusive<usize>> for Array<Type, N> {
142 #[inline]
143 fn index_mut(&mut self, index: RangeToInclusive<usize>) -> &mut Self::Output {self.as_mut().index_mut(index)}
144}