From 547e4d7517c2ff366879dd7926dd8fdc99609c74 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 12 Apr 2022 15:13:03 -0400 Subject: [PATCH] fix comments --- src/misc.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/misc.rs b/src/misc.rs index 7e03869..c06fc09 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -80,17 +80,14 @@ pub struct SteppedVector { /// Maximum value max: f64, - /// Since all entries in `data` are evenly spaced, this field stores the - /// step between 2 adjacent elements + /// Since all entries in `data` are evenly spaced, this field stores the step between 2 adjacent elements step: f64, } impl SteppedVector { - /// Returns `Option` with index of element with value `x`. and `None` - /// if `x` does not exist in `data` + /// Returns `Option` with index of element with value `x`. and `None` if `x` does not exist in `data` pub fn get_index(&self, x: &f64) -> Option { - // if `x` is outside range, just go ahead and return `None` as it *shouldn't* be - // in `data` + // if `x` is outside range, just go ahead and return `None` as it *shouldn't* be in `data` if (x > &self.max) | (&self.min > x) { return None; } @@ -106,8 +103,7 @@ impl SteppedVector { // Do some math in order to calculate the expected index value let possible_i = ((x - self.min) / self.step) as usize; - // Make sure that the index is valid by checking the data returned vs the actual - // data (just in case) + // Make sure that the index is valid by checking the data returned vs the actual data (just in case) if &self.data[possible_i] == x { // It is valid! Some(possible_i) @@ -165,8 +161,7 @@ impl From> for SteppedVector { } } -/// Implements traits that are useful when dealing with Vectors of egui's -/// `Value` +/// Implements traits that are useful when dealing with Vectors of egui's `Value` pub trait EguiHelper { /// Converts to `egui::plot::Line` fn to_line(&self) -> Line;