From ee5be9876a0b4d750997a5de285f9e11e72f7e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Chodzikiewicz?= Date: Wed, 3 Mar 2021 23:50:35 +0100 Subject: [PATCH 1/4] Fix urls in inline docs to files hosted on gitlab --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 151f2a0..1fa0a7b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,9 +16,9 @@ //! ### Single plot //! Simple plot example //! #### On color display: -//! ![single plot on color display](doc-resources/single-plot-color.png "Color plot of single curve") +//! ![single plot on color display](https://gitlab.com/mchodzikiewicz/embedded-plots/-/raw/master/single-plot-color.png "Color plot of single curve") //! #### On monochromatic display: -//! ![single plot on monochromatic display](doc-resources/single-plot-mono.png "Monochromatic plot of single curve") +//! ![single plot on monochromatic display](https://gitlab.com/mchodzikiewicz/embedded-plots/-/raw/master/single-plot-mono.png "Monochromatic plot of single curve") //! //! Code to render: //! ```rust @@ -56,7 +56,7 @@ //! //! ### Axis //! You can also use axis on its own, it looks like this: -//! ![free axis examples](doc-resources/free-axis-example.png "Free axis example") +//! ![free axis examples](https://gitlab.com/mchodzikiewicz/embedded-plots/-/raw/master/doc-resources/free-axis-example.png "Free axis example") //! Code to render example axis: //! ```rust //! use embedded_plots::axis::{Axis, Scale, Placement}; From cbc0083fb47e748c74b4694d7d2183abbccc39a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Chodzikiewicz?= Date: Thu, 4 Mar 2021 11:29:27 +0100 Subject: [PATCH 2/4] Substitute curve's mutable elements with .tuple_windows(), remove dummy tests --- src/curve.rs | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/curve.rs b/src/curve.rs index 0c0a736..00e5eb6 100644 --- a/src/curve.rs +++ b/src/curve.rs @@ -102,7 +102,7 @@ impl DrawableCurve } /// set curve line thickness - pub fn set_thickness(mut self, thickness: usize) -> DrawableCurve { + pub fn set_thickness(mut self, thickness: usize) -> DrawableCurve { self.thickness = Some(thickness); self } @@ -123,22 +123,13 @@ impl Drawable for DrawableCurve Some(t) => t, }; let style = PrimitiveStyle::with_stroke(color, thickness as u32); - let mut iter = self.scaled_data.into_iter(); - let mut prev = iter.next().unwrap(); - for point in iter { - Line::new(prev, point) - .into_styled(style) - .draw(display)?; - prev = point; - } - Ok(()) + self.scaled_data + .tuple_windows() + .try_for_each(|(prev, point)| -> Result<(), D::Error> { + Line::new(prev, point) + .into_styled(style) + .draw(display) + }) } } -#[cfg(test)] -mod tests { - #[test] - fn it_works() { - assert_eq!(2 + 2, 4); - } -} From 961679608da28a0acbd385b34085dc41554e6a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Chodzikiewicz?= Date: Thu, 4 Mar 2021 17:54:57 +0100 Subject: [PATCH 3/4] Add no-std to categories --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index c6bd45b..9aedeef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ homepage = "https://gitlab.com/mchodzikiewicz/embedded-plots" repository = "https://gitlab.com/mchodzikiewicz/embedded-plots" readme = "README.md" keywords = ["embedded", "plot", "graphics"] -categories = ["embedded","visualization"] +categories = ["embedded","visualization","no-std","graphics"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html From e45c70e2f79ae3eaa16bf1941865a17af650295c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Chodzikiewicz?= Date: Sun, 19 Jun 2022 18:52:54 +0200 Subject: [PATCH 4/4] Fix std dependency from itertools --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 9aedeef..bd53711 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ categories = ["embedded","visualization","no-std","graphics"] [dependencies] embedded-graphics = "0.6.0" -itertools = "0.9.0" +itertools = {version = "0.9.0", default-features = false} heapless = "0.5.6" [dev-dependencies]