1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
use std::ops::{Index, IndexMut};

use crate::Polynomial;

impl Index<usize> for Polynomial {
    type Output = isize;
    fn index(&self, index: usize) -> &Self::Output {
        &(self.coeffs[index])
    }
}

impl IndexMut<usize> for Polynomial {
    fn index_mut(&mut self, index: usize) -> &mut Self::Output {
        &mut (self.coeffs[index])
    }
}