display views: return error instead of unwrapping
This commit was merged in pull request #49.
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user