1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use shape::Shape;

impl PartialEq for Shape {
    /// Returns true if two shapes have equal dimensions
    ///
    /// # Arguments
    ///
    /// * `other` - shape to compare shape with
    fn eq(&self, other: &Shape) -> bool {
        let f_shape = self.get_shape();
        let s_shape = other.get_shape();

        if f_shape.len() == s_shape.len() {
            return f_shape
                .iter()
                .zip(s_shape.iter())
                .all(|(f, s)| f == s);
        }

        return false;
    }
}

impl Eq for Shape {}