From 5fd842c0cd1e61eddbe45a2447a40fe5e8e1c76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Chodzikiewicz?= Date: Fri, 23 Jul 2021 13:37:54 +0200 Subject: [PATCH] Update heapless to use const generics --- Cargo.toml | 2 +- src/axis.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8e0f60f..5ab7021 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ categories = ["embedded","visualization","no-std","graphics"] [dependencies] embedded-graphics = "0.6.0" itertools = {version = "0.9.0", default-features = false} -heapless = "0.5.6" +heapless = "0.7.3" [dev-dependencies] embedded-graphics-simulator = "0.2.1" diff --git a/src/axis.rs b/src/axis.rs index cd5b038..6531f68 100644 --- a/src/axis.rs +++ b/src/axis.rs @@ -1,6 +1,6 @@ use core::ops::Range; use core::fmt::Write; -use heapless::{consts::*, String}; +use heapless::String; use embedded_graphics::{ prelude::*, @@ -173,7 +173,7 @@ impl<'a, C, F> Drawable for DrawableAxis<'a, C, F> Line { start: Point { x, y: y - tick_size as i32 }, end: Point { x, y: y + tick_size as i32 } } .into_styled(PrimitiveStyle::with_stroke(color, thickness as u32)) .draw(display)?; - let mut buf: String:: = String::new(); + let mut buf: String::<8> = String::new(); write!(buf, "{}", mark).unwrap(); Text::new(&buf, Point { x: x + 2, y: y + 2 }).into_styled(text_style).draw(display)?; } @@ -189,7 +189,7 @@ impl<'a, C, F> Drawable for DrawableAxis<'a, C, F> Line { start: Point { x: x - tick_size as i32, y }, end: Point { x: x + tick_size as i32, y } } .into_styled(PrimitiveStyle::with_stroke(color, thickness as u32)) .draw(display)?; - let mut buf: String:: = String::new(); + let mut buf: String::<8> = String::new(); write!(buf, "{}", mark).unwrap(); let tick_val = Text::new(&buf, Point { x, y }).into_styled(text_style); let tick_val = tick_val.translate(Point { x: -(tick_val.size().width as i32) - 2, y: 2 });