spitzenfinder 0.4.4

A program to find peaks and plot fourier.out files of the VIBES program.
Documentation
use std::cmp;
use crate::data::errors::DivisionByZero;
    ///Represents the slope between two points.
    #[derive(Debug, Clone, Copy)]
    pub struct Slope2D {
        /// First reference point
        pub from: (f32, f32),
        /// Second reference point
        pub to: (f32, f32),
        /// Slope between first and second point.
        pub is: f32,
    }

    impl Default for Slope2D {
        /// Default constructor for Slope struct.
        fn default() -> Self {
            Slope2D {
                from: (0_f32, 0_f32),
                to: (0_f32, 0_f32),
                is: 0.0_f32,
            }
        }
    }

    impl Slope2D {
        /// Returns a Slope struct. The slope is computed between the reference points `from` and `to`.
        /// It is assumed the the first value in one of the tuples is the x-coordinate. The 2nd is
        /// the y-coordinate, respectively.
        ///
        /// # Arguments
        ///
        /// * `from` - The first reference point.
        /// * `to` -  The second reference point.
        ///
        pub fn new(from: (f32, f32), to: (f32, f32)) -> Result<Slope2D, DivisionByZero> {
            let delta_x = to.0 - from.0;
            if delta_x == 0.0_f32 {
                return Err(DivisionByZero);
            }
            let delta_y = to.1 - from.1;
            let is = delta_y / delta_x;
            Ok(Slope2D { from, to, is })
        }
    }

    impl PartialEq for Slope2D {
        fn eq(&self, other: &Self) -> bool {
            self.is == other.is
        }
    }

    impl Eq for Slope2D {}

    impl PartialOrd for Slope2D {
        fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
            self.is.partial_cmp(&other.is)
        }
    }

    impl Ord for Slope2D {
        fn cmp(&self, other: &Self) -> cmp::Ordering {
            self.is.total_cmp(&other.is)
        }
    }