display views: return error instead of unwrapping

This commit was merged in pull request #49.
This commit is contained in:
2026-08-29 21:09:09 +00:00
parent ef10eec216
commit 153acffb86
9 changed files with 114 additions and 40 deletions
+3 -6
View File
@@ -1,6 +1,3 @@
use alloc::boxed::Box;
use core::error;
use crate::peripherals::Peripherals;
use embedded_graphics::Drawable;
use embedded_graphics::draw_target::DrawTarget;
use embedded_graphics::mono_font::MonoTextStyle;
@@ -10,7 +7,7 @@ use embedded_graphics::prelude::Point;
use embedded_graphics::prelude::RgbColor;
use embedded_graphics::text::Text;
pub fn show<D>(display: &mut D, name: &str, position: i32, selected: i32)
pub fn show<D>(display: &mut D, name: &str, position: i32, selected: i32) -> Result<(), D::Error>
where
D: DrawTarget<Color = Rgb565>,
D::Error: core::fmt::Debug,
@@ -27,6 +24,6 @@ where
style
},
)
.draw(display)
.unwrap();
.draw(display)?;
Ok(())
}