i_shape 4.0.0

iShape is a compact and efficient library specifically designed for representing 2D data structures using IntPoint.
Documentation
use crate::base::data::{Contour, Shape};
use i_float::float::compatible::FloatPointCompatible;

pub trait PointsCount<P> {
    fn points_count(&self) -> usize;
}

impl<P> PointsCount<P> for [Contour<P>]
where
    P: FloatPointCompatible,
{
    fn points_count(&self) -> usize {
        self.iter().fold(0, |acc, list| acc + list.len())
    }
}

impl<P> PointsCount<P> for [Shape<P>]
where
    P: FloatPointCompatible,
{
    fn points_count(&self) -> usize {
        self.iter().fold(0, |acc, lists| acc + lists.points_count())
    }
}