scsys_crypto/hash/h160/
impl_ops.rs

1/*
2    Appellation: impl_ops <module>
3    Contrib: @FL03
4*/
5use super::H160;
6
7impl core::ops::Index<usize> for H160 {
8    type Output = u8;
9
10    fn index(&self, index: usize) -> &Self::Output {
11        &self.0[index]
12    }
13}
14
15impl core::ops::IndexMut<usize> for H160 {
16    fn index_mut(&mut self, index: usize) -> &mut Self::Output {
17        &mut self.0[index]
18    }
19}
20
21impl core::ops::Index<core::ops::Range<usize>> for H160 {
22    type Output = [u8];
23
24    fn index(&self, index: core::ops::Range<usize>) -> &Self::Output {
25        &self.0[index]
26    }
27}
28
29impl core::ops::IndexMut<core::ops::Range<usize>> for H160 {
30    fn index_mut(&mut self, index: core::ops::Range<usize>) -> &mut Self::Output {
31        &mut self.0[index]
32    }
33}