polynomint/
index.rs

1use std::ops::{Index, IndexMut};
2
3use crate::Polynomial;
4
5impl Index<usize> for Polynomial {
6    type Output = isize;
7    fn index(&self, index: usize) -> &Self::Output {
8        &(self.coeffs[index])
9    }
10}
11
12impl IndexMut<usize> for Polynomial {
13    fn index_mut(&mut self, index: usize) -> &mut Self::Output {
14        &mut (self.coeffs[index])
15    }
16}