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 fn index(&self, index: usize) -> &Self::Output {self.get(index).unwrap()}
29}
30
31const impl<Type, const N: usize> IndexMut<usize> for Array<Type, N> {
33 fn index_mut(&mut self, index: usize) -> &mut Self::Output {self.get_mut(index).unwrap()}
34}
35
36
37const impl<Type, const N: usize> Index<Range<usize>> for Array<Type, N> {
43 type Output = [Type];
44 fn index(&self, index: Range<usize>) -> &Self::Output {self.as_ref().index(index)}
45}
46
47const impl<Type, const N: usize> IndexMut<Range<usize>> for Array<Type, N> {
49 fn index_mut(&mut self, index: Range<usize>) -> &mut Self::Output {self.as_mut().index_mut(index)}
50}
51
52
53const impl<Type, const N: usize> Index<RangeFrom<usize>> for Array<Type, N> {
59 type Output = [Type];
60 fn index(&self, index: RangeFrom<usize>) -> &Self::Output {self.as_ref().index(index)}
61}
62
63const impl<Type, const N: usize> IndexMut<RangeFrom<usize>> for Array<Type, N> {
65 fn index_mut(&mut self, index: RangeFrom<usize>) -> &mut Self::Output {self.as_mut().index_mut(index)}
66}
67
68
69const impl<Type, const N: usize> Index<RangeFull> for Array<Type, N> {
75 type Output = [Type];
76 fn index(&self, index: RangeFull) -> &Self::Output {self.as_ref().index(index)}
77}
78
79const impl<Type, const N: usize> IndexMut<RangeFull> for Array<Type, N> {
81 fn index_mut(&mut self, index: RangeFull) -> &mut Self::Output {self.as_mut().index_mut(index)}
82}
83
84
85const impl<Type, const N: usize> Index<RangeInclusive<usize>> for Array<Type, N> {
91 type Output = [Type];
92 fn index(&self, index: RangeInclusive<usize>) -> &Self::Output {self.as_ref().index(index)}
93}
94
95const impl<Type, const N: usize> IndexMut<RangeInclusive<usize>> for Array<Type, N> {
97 fn index_mut(&mut self, index: RangeInclusive<usize>) -> &mut Self::Output {self.as_mut().index_mut(index)}
98}
99
100
101const impl<Type, const N: usize> Index<RangeTo<usize>> for Array<Type, N> {
107 type Output = [Type];
108 fn index(&self, index: RangeTo<usize>) -> &Self::Output {self.as_ref().index(index)}
109}
110
111const impl<Type, const N: usize> IndexMut<RangeTo<usize>> for Array<Type, N> {
113 fn index_mut(&mut self, index: RangeTo<usize>) -> &mut Self::Output {self.as_mut().index_mut(index)}
114}
115
116
117const impl<Type, const N: usize> Index<RangeToInclusive<usize>> for Array<Type, N> {
123 type Output = [Type];
124 fn index(&self, index: RangeToInclusive<usize>) -> &Self::Output {self.as_ref().index(index)}
125}
126
127const impl<Type, const N: usize> IndexMut<RangeToInclusive<usize>> for Array<Type, N> {
129 fn index_mut(&mut self, index: RangeToInclusive<usize>) -> &mut Self::Output {self.as_mut().index_mut(index)}
130}