use std::ops::Index;
#[derive(Debug, Clone, PartialEq)]
pub struct Shape {
bound: Vec<usize>,
}
impl Index<usize> for Shape {
type Output = usize;
fn index(&self, ind: usize) -> &Self::Output {
&self.bound[ind]
}
}
impl Shape {
pub fn new<const RANK: usize>(s: [usize; RANK]) -> Self {
Shape { bound: s.to_vec() }
}
pub fn size(&self) -> usize {
let mut ret: usize = 1;
for b in &self.bound {
ret *= b;
}
ret
}
}