diff --git a/Cargo.toml b/Cargo.toml index 06b993df..d7bd0c20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,3 +4,5 @@ members = [ "lvgl-codegen", "lvgl-sys", ] + +resolver = "2" diff --git a/lvgl-codegen/src/lib.rs b/lvgl-codegen/src/lib.rs index 1998b8bc..75a02432 100644 --- a/lvgl-codegen/src/lib.rs +++ b/lvgl-codegen/src/lib.rs @@ -66,7 +66,7 @@ impl Rusty for LvWidget { Ok(quote! { define_object!(#widget_name); - impl #widget_name { + impl<'a> #widget_name<'a> { #(#methods)* } }) @@ -122,7 +122,7 @@ impl Rusty for LvFunc { } pub fn new() -> crate::LvResult { - let mut parent = crate::display::DefaultDisplay::get_scr_act()?; + let mut parent = crate::display::get_scr_act()?; Self::create(&mut parent) } @@ -613,7 +613,7 @@ mod test { let expected_code = quote! { define_object!(Arc); - impl Arc { + impl<'a> Arc<'a> { } }; @@ -645,7 +645,7 @@ mod test { let expected_code = quote! { define_object!(Arc); - impl Arc { + impl<'a> Arc<'a> { pub fn create(parent: &mut impl crate::NativeObject) -> crate::LvResult { unsafe { let ptr = lvgl_sys::lv_arc_create( @@ -661,7 +661,7 @@ mod test { } pub fn new() -> crate::LvResult { - let mut parent = crate::display::DefaultDisplay::get_scr_act()?; + let mut parent = crate::display::get_scr_act()?; Self::create(&mut parent) } } diff --git a/lvgl-sys/src/lib.rs b/lvgl-sys/src/lib.rs index ca2fadf9..fd35f222 100644 --- a/lvgl-sys/src/lib.rs +++ b/lvgl-sys/src/lib.rs @@ -23,10 +23,10 @@ mod tests { lv_init(); let horizontal_resolution = lv_disp_get_hor_res(core::ptr::null_mut()); - assert_eq!(horizontal_resolution, 0 as i16); + assert_eq!(horizontal_resolution, 0); let vertical_resolution = lv_disp_get_ver_res(core::ptr::null_mut()); - assert_eq!(vertical_resolution, 0 as i16); + assert_eq!(vertical_resolution, 0); } } } diff --git a/lvgl/src/display.rs b/lvgl/src/display.rs index d3318c42..a574702e 100644 --- a/lvgl/src/display.rs +++ b/lvgl/src/display.rs @@ -3,13 +3,13 @@ use crate::Screen; use crate::{disp_drv_register, disp_get_default, get_str_act, LvResult, NativeObject}; use crate::{Box, Color}; use core::convert::TryInto; +#[cfg(feature = "nightly")] +use core::error::Error; +use core::fmt; use core::mem::{ManuallyDrop, MaybeUninit}; use core::pin::Pin; use core::ptr::NonNull; use core::{ptr, result}; -use core::fmt; -#[cfg(feature = "nightly")] -use core::error::Error; /// Error in interacting with a `Display`. #[derive(Debug, Copy, Clone, Eq, PartialEq)] @@ -21,11 +21,15 @@ pub enum DisplayError { impl fmt::Display for DisplayError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "Display {}", match self { - DisplayError::NotAvailable => "not available", - DisplayError::FailedToRegister => "failed to register", - DisplayError::NotRegistered => "not registered", - }) + write!( + f, + "Display {}", + match self { + DisplayError::NotAvailable => "not available", + DisplayError::FailedToRegister => "failed to register", + DisplayError::NotRegistered => "not registered", + } + ) } } @@ -63,18 +67,17 @@ impl<'a> Display { let disp_p = &mut display_diver.disp_drv; disp_p.hor_res = hor_res.try_into().unwrap_or(240); disp_p.ver_res = ver_res.try_into().unwrap_or(240); - let ret = Ok(disp_drv_register(&mut display_diver, None)?); + Ok(disp_drv_register(&mut display_diver, None)?) //display_diver.disp_drv.leak(); - ret } /// Returns the current active screen. - pub fn get_scr_act(&self) -> Result { + pub fn get_scr_act(&'a self) -> Result> { Ok(get_str_act(Some(self))?.try_into()?) } /// Sets a `Screen` as currently active. - pub fn set_scr_act(&mut self, screen: &mut Screen) -> LvResult<()> { + pub fn set_scr_act(&'a self, screen: &'a mut Screen) -> LvResult<()> { let scr_ptr = unsafe { screen.raw()?.as_mut() }; unsafe { lvgl_sys::lv_disp_load_scr(scr_ptr) } Ok(()) @@ -152,14 +155,9 @@ impl Drop for Display { } } -#[derive(Copy, Clone)] -pub(crate) struct DefaultDisplay {} - -impl DefaultDisplay { - /// Gets the active screen of the default display. - pub(crate) fn get_scr_act() -> Result { - Ok(get_str_act(None)?.try_into()?) - } +/// Gets the active screen of the default display. +pub(crate) fn get_scr_act() -> Result> { + Ok(get_str_act(None)?.try_into()?) } /// A buffer of size `N` representing `N` pixels. `N` can be smaller than the @@ -401,8 +399,7 @@ mod tests { let _screen_direct = display .get_scr_act() .expect("Return screen directly from the display instance"); - let _screen_default = - DefaultDisplay::get_scr_act().expect("Return screen from the default display"); + let _screen_default = get_scr_act().expect("Return screen from the default display"); } #[test] diff --git a/lvgl/src/functions.rs b/lvgl/src/functions.rs index 26b40d9e..feb6250f 100644 --- a/lvgl/src/functions.rs +++ b/lvgl/src/functions.rs @@ -69,7 +69,10 @@ pub fn task_handler() { /// Directly send an event to a specific widget. #[inline] -pub fn event_send(obj: &mut W, event: Event) -> LvResult<()> { +pub fn event_send Widget<'a>>( + obj: &mut W, + event: Event<>::SpecialEvent>, +) -> LvResult<()> { unsafe { lvgl_sys::lv_event_send(obj.raw()?.as_mut(), event.into(), ptr::null_mut()); }; diff --git a/lvgl/src/lib.rs b/lvgl/src/lib.rs index ce8db6f7..148cbd05 100644 --- a/lvgl/src/lib.rs +++ b/lvgl/src/lib.rs @@ -109,8 +109,12 @@ fn once_init() { } } -/// Initializes LVGL. Unless `unsafe_no_autoinit` is enabled, do not call -/// without first calling `deinit()` and dropping all old values. +/// Initializes LVGL. +/// +/// # Safety +/// +/// Unless `unsafe_no_autoinit` is enabled, do not call this function without +/// first calling `deinit()` and dropping all old values. #[cfg(not(feature = "unsafe_no_autoinit"))] pub unsafe fn init() { unsafe { @@ -119,6 +123,10 @@ pub unsafe fn init() { } /// Uninitializes LVGL. Make sure to reinitialize it before reusing it. +/// +/// # Safety +/// +/// This function should not be called if LVGL is already uninitialized. pub unsafe fn deinit() { unsafe { lvgl_sys::lv_deinit() } } diff --git a/lvgl/src/lv_core/obj.rs b/lvgl/src/lv_core/obj.rs index 77194cc2..26797e87 100644 --- a/lvgl/src/lv_core/obj.rs +++ b/lvgl/src/lv_core/obj.rs @@ -8,6 +8,7 @@ use crate::lv_core::style::Style; use crate::{Align, LvError, LvResult}; use core::fmt::{self, Debug}; +use core::marker::PhantomData; use core::ptr; /// Represents a native LVGL object. @@ -19,13 +20,15 @@ pub trait NativeObject { /// Generic LVGL object. /// /// This is the parent object of all widget types. It stores the native LVGL raw pointer. -pub struct Obj { +pub struct Obj<'a> { // We use a raw pointer here because we do not control this memory address, it is controlled // by LVGL's global state. raw: *mut lvgl_sys::lv_obj_t, + // This is to ensure safety for style memory; it has no runtime impact + styles_used: PhantomData<&'a lvgl_sys::lv_style_t>, } -impl Debug for Obj { +impl Debug for Obj<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("NativeObject") .field("raw", &"!! LVGL lv_obj_t ptr !!") @@ -35,13 +38,16 @@ impl Debug for Obj { // We need to manually impl methods on Obj since widget codegen is defined in // terms of Obj -impl Obj { +impl Obj<'_> { pub fn create(parent: &mut impl NativeObject) -> LvResult { unsafe { let ptr = lvgl_sys::lv_obj_create(parent.raw()?.as_mut()); if ptr::NonNull::new(ptr).is_some() { //(*ptr).user_data = Box::new(UserDataObj::empty()).into_raw() as *mut _; - Ok(Self { raw: ptr }) + Ok(Self { + raw: ptr, + styles_used: PhantomData, + }) } else { Err(LvError::InvalidReference) } @@ -49,12 +55,12 @@ impl Obj { } pub fn new() -> crate::LvResult { - let mut parent = crate::display::DefaultDisplay::get_scr_act()?; + let mut parent = crate::display::get_scr_act()?; Self::create(&mut parent) } } -impl NativeObject for Obj { +impl NativeObject for Obj<'_> { fn raw(&self) -> LvResult> { if let Some(non_null_ptr) = ptr::NonNull::new(self.raw) { Ok(non_null_ptr) @@ -65,7 +71,7 @@ impl NativeObject for Obj { } /// A wrapper for all LVGL common operations on generic objects. -pub trait Widget: NativeObject + Sized { +pub trait Widget<'a>: NativeObject + Sized + 'a { type SpecialEvent; type Part: Into; @@ -79,7 +85,7 @@ pub trait Widget: NativeObject + Sized { unsafe fn from_raw(raw_pointer: ptr::NonNull) -> Option; /// Adds a `Style` to a given widget. - fn add_style(&mut self, part: Self::Part, style: &mut Style) -> LvResult<()> { + fn add_style(&mut self, part: Self::Part, style: &'a mut Style) -> LvResult<()> { unsafe { lvgl_sys::lv_obj_add_style( self.raw()?.as_mut(), @@ -144,19 +150,23 @@ pub trait Widget: NativeObject + Sized { } } -impl Widget for Obj { +impl<'a> Widget<'a> for Obj<'a> { type SpecialEvent = u32; type Part = Part; unsafe fn from_raw(raw: ptr::NonNull) -> Option { - Some(Self { raw: raw.as_ptr() }) + Some(Self { + raw: raw.as_ptr(), + styles_used: PhantomData, + }) } } -impl Default for Obj { +impl Default for Obj<'_> { fn default() -> Self { Self { raw: unsafe { lvgl_sys::lv_obj_create(ptr::null_mut()) }, + styles_used: PhantomData, } } } @@ -176,14 +186,14 @@ macro_rules! define_object { }; ($item:ident, event = $event_type:ty, part = $part_type:ty) => { #[derive(Debug)] - pub struct $item { - core: $crate::Obj, + pub struct $item<'a> { + core: $crate::Obj<'a>, } - impl $item { + impl<'a> $item<'a> { pub fn on_event(&mut self, f: F) -> $crate::LvResult<()> where - F: FnMut(Self, $crate::support::Event<::SpecialEvent>), + F: FnMut(Self, $crate::support::Event<>::SpecialEvent>), { use $crate::NativeObject; unsafe { @@ -191,7 +201,9 @@ macro_rules! define_object { obj.user_data = $crate::Box::into_raw($crate::Box::new(f)) as *mut _; lvgl_sys::lv_obj_add_event_cb( obj, - lvgl_sys::lv_event_cb_t::Some($crate::support::event_callback::), + lvgl_sys::lv_event_cb_t::Some( + $crate::support::event_callback::<'a, Self, F>, + ), lvgl_sys::lv_event_code_t_LV_EVENT_ALL, obj.user_data, ); @@ -200,13 +212,13 @@ macro_rules! define_object { } } - impl $crate::NativeObject for $item { + impl $crate::NativeObject for $item<'_> { fn raw(&self) -> $crate::LvResult> { self.core.raw() } } - impl $crate::Widget for $item { + impl<'a> $crate::Widget<'a> for $item<'a> { type SpecialEvent = $event_type; type Part = $part_type; @@ -248,7 +260,7 @@ macro_rules! define_object { // } // // pub fn new() -> crate::LvResult { -// let mut parent = crate::display::DefaultDisplay::get_scr_act()?; +// let mut parent = crate::display::get_scr_act()?; // Ok(Self::create_at(&mut parent)?) // } // } diff --git a/lvgl/src/lv_core/screen.rs b/lvgl/src/lv_core/screen.rs index e6ced46b..55b2005a 100644 --- a/lvgl/src/lv_core/screen.rs +++ b/lvgl/src/lv_core/screen.rs @@ -1,26 +1,18 @@ use crate::{LvError, NativeObject, Obj, Part, Widget}; /// An LVGL screen. -#[derive(Debug)] -pub struct Screen { - raw: Obj, +#[derive(Debug, Default)] +pub struct Screen<'a> { + raw: Obj<'a>, } -impl Default for Screen { - fn default() -> Self { - Self { - raw: Obj::default(), - } - } -} - -impl NativeObject for Screen { +impl NativeObject for Screen<'_> { fn raw(&self) -> crate::LvResult> { self.raw.raw() } } -impl Widget for Screen { +impl<'a> Widget<'a> for Screen<'a> { type SpecialEvent = u32; type Part = Part; @@ -32,31 +24,31 @@ impl Widget for Screen { } } -impl TryFrom for Screen { +impl<'a> TryFrom> for Screen<'a> { type Error = LvError; - fn try_from(value: Obj) -> Result { - match unsafe { (*value.raw()?.as_mut()).parent } as usize { + fn try_from(value: Obj<'a>) -> Result { + match unsafe { value.raw()?.as_mut().parent } as usize { 0 => Ok(Self { raw: value }), _ => Err(LvError::InvalidReference), } } } -impl Into for Screen { - fn into(self) -> Obj { +impl<'a> Into> for Screen<'a> { + fn into(self) -> Obj<'a> { self.raw } } -impl AsRef for Screen { - fn as_ref(&self) -> &Obj { +impl<'a> AsRef> for Screen<'a> { + fn as_ref(&self) -> &Obj<'a> { &self.raw } } -impl AsMut for Screen { - fn as_mut(&mut self) -> &mut Obj { +impl<'a> AsMut> for Screen<'a> { + fn as_mut(&mut self) -> &mut Obj<'a> { &mut self.raw } } @@ -72,7 +64,7 @@ mod test { const VER_RES: u32 = 240; crate::tests::initialize_test(false); let buffer = DrawBuffer::<{ (HOR_RES * VER_RES) as usize }>::default(); - let mut display = Display::register(buffer, HOR_RES, VER_RES, |_| {}).unwrap(); + let display = Display::register(buffer, HOR_RES, VER_RES, |_| {}).unwrap(); let mut screen_old = display.get_scr_act().unwrap(); let mut screen_new = Screen::default(); display.set_scr_act(&mut screen_new).unwrap(); diff --git a/lvgl/src/lv_core/style.rs b/lvgl/src/lv_core/style.rs index 480976a7..f37a34a4 100644 --- a/lvgl/src/lv_core/style.rs +++ b/lvgl/src/lv_core/style.rs @@ -217,10 +217,7 @@ pub enum StyleValues { impl StyleValues { pub fn is_some(&self) -> bool { - match self { - StyleValues::None => false, - _ => true, - } + !matches!(self, StyleValues::None) } } diff --git a/lvgl/src/misc/anim.rs b/lvgl/src/misc/anim.rs index 92e82fe9..b8a2263a 100644 --- a/lvgl/src/misc/anim.rs +++ b/lvgl/src/misc/anim.rs @@ -21,7 +21,7 @@ pub struct Animation { impl Animation { /// Instantiates an `Animation` with the required attributes. - pub fn new<'a, T, F>( + pub fn new<'a, 'b, T, F>( target: &mut T, duration: Duration, start: i32, @@ -29,7 +29,7 @@ impl Animation { animator: F, ) -> LvResult where - T: Widget, + T: Widget<'b>, F: FnMut(&mut Obj, i32) + 'a, { unsafe { @@ -43,13 +43,13 @@ impl Animation { }, }; - (*anim.raw).time = duration.as_millis().try_into().unwrap_or(0); - (*anim.raw).start_value = start; - (*anim.raw).current_value = start; - (*anim.raw).end_value = end; - (*anim.raw).user_data = Box::::into_raw(Box::new(animator)) as *mut _; - (*anim.raw).var = target as *mut _ as *mut _; - (*anim.raw).exec_cb = Some(animator_trampoline::); + anim.raw.time = duration.as_millis().try_into().unwrap_or(0); + anim.raw.start_value = start; + anim.raw.current_value = start; + anim.raw.end_value = end; + anim.raw.user_data = Box::::into_raw(Box::new(animator)) as *mut _; + anim.raw.var = target as *mut _ as *mut _; + anim.raw.exec_cb = Some(animator_trampoline::<'a, 'b, T, F>); Ok(anim) } @@ -64,32 +64,32 @@ impl Animation { /// Sets the delay before starting the animation. pub fn set_delay(&mut self, delay: Duration) -> Result<(), TryFromIntError> { - (*self.raw).act_time = -(delay.as_millis().try_into()?); + self.raw.act_time = -(delay.as_millis().try_into()?); Ok(()) } /// Sets the delay before playback. pub fn set_playback_delay(&mut self, delay: Duration) -> Result<(), TryFromIntError> { - (*self.raw).playback_delay = delay.as_millis().try_into()?; + self.raw.playback_delay = delay.as_millis().try_into()?; Ok(()) } /// Sets the total playback time. pub fn set_playback_time(&mut self, time: Duration) -> Result<(), TryFromIntError> { - (*self.raw).playback_time = time.as_millis().try_into()?; + self.raw.playback_time = time.as_millis().try_into()?; Ok(()) } /// Sets the delay before repeating the animation. pub fn set_repeat_delay(&mut self, delay: Duration) -> Result<(), TryFromIntError> { - (*self.raw).repeat_delay = delay.as_millis().try_into()?; + self.raw.repeat_delay = delay.as_millis().try_into()?; Ok(()) } /// Sets how many times the animation repeats. pub fn set_repeat_count(&mut self, count: AnimRepeatCount) { unsafe { - (*self.raw).repeat_cnt = match count { + self.raw.repeat_cnt = match count { AnimRepeatCount::Finite(c) => c, AnimRepeatCount::Infinite => lvgl_sys::LV_ANIM_REPEAT_INFINITE .try_into() @@ -104,9 +104,9 @@ impl Animation { } } -unsafe extern "C" fn animator_trampoline<'a, T, F>(obj: *mut c_void, val: i32) +unsafe extern "C" fn animator_trampoline<'a, 'b, T, F>(obj: *mut c_void, val: i32) where - T: Widget, + T: Widget<'b>, F: FnMut(&mut Obj, i32) + 'a, { unsafe { diff --git a/lvgl/src/support.rs b/lvgl/src/support.rs index ac285ce1..a85cba6a 100644 --- a/lvgl/src/support.rs +++ b/lvgl/src/support.rs @@ -1,10 +1,10 @@ use crate::display::DisplayError; use crate::Widget; use core::convert::{TryFrom, TryInto}; -use core::ptr::NonNull; -use core::fmt; #[cfg(feature = "nightly")] use core::error::Error; +use core::fmt; +use core::ptr::NonNull; #[cfg(feature = "embedded_graphics")] use embedded_graphics::pixelcolor::{Rgb565, Rgb888}; @@ -21,12 +21,16 @@ pub enum LvError { impl fmt::Display for LvError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}", match self { - LvError::InvalidReference => "Accessed invalid reference or ptr", - LvError::Uninitialized => "LVGL uninitialized", - LvError::LvOOMemory => "LVGL out of memory", - LvError::AlreadyInUse => "Resource already in use", - }) + write!( + f, + "{}", + match self { + LvError::InvalidReference => "Accessed invalid reference or ptr", + LvError::Uninitialized => "LVGL uninitialized", + LvError::LvOOMemory => "LVGL out of memory", + LvError::AlreadyInUse => "Resource already in use", + } + ) } } @@ -273,10 +277,10 @@ pub enum PointerEvent { DragThrowBegin, } -pub(crate) unsafe extern "C" fn event_callback(event: *mut lvgl_sys::lv_event_t) +pub(crate) unsafe extern "C" fn event_callback<'a, T, F>(event: *mut lvgl_sys::lv_event_t) where - T: Widget + Sized, - F: FnMut(T, Event), + T: Widget<'a> + Sized, + F: FnMut(T, Event<>::SpecialEvent>), { let code = (*event).code; let obj = (*event).target; @@ -389,9 +393,9 @@ pub enum LabelLongMode { Wrap = lvgl_sys::LV_LABEL_LONG_WRAP, } -impl Into for LabelLongMode { - fn into(self) -> u8 { - unsafe { (self as u32).try_into().unwrap_unchecked() } +impl From for u8 { + fn from(value: LabelLongMode) -> Self { + unsafe { (value as u32).try_into().unwrap_unchecked() } } } diff --git a/lvgl/src/widgets/arc.rs b/lvgl/src/widgets/arc.rs index 2825985e..17bcdb6a 100644 --- a/lvgl/src/widgets/arc.rs +++ b/lvgl/src/widgets/arc.rs @@ -2,7 +2,7 @@ use crate::lv_core::obj::NativeObject; use crate::widgets::Arc; use crate::LvResult; -impl Arc { +impl Arc<'_> { // /// Set the start angle, for the given arc part. // /// 0 degrees for the right, 90 degrees for the bottom, etc. // pub fn set_start_angle(&mut self, angle: u16, part: ArcPart) -> LvResult<()> { diff --git a/lvgl/src/widgets/bar.rs b/lvgl/src/widgets/bar.rs index a34f5947..c6aaeb87 100644 --- a/lvgl/src/widgets/bar.rs +++ b/lvgl/src/widgets/bar.rs @@ -2,7 +2,7 @@ use crate::support::AnimationState; use crate::widgets::Bar; use crate::{LvResult, NativeObject}; -impl Bar { +impl Bar<'_> { /// Set minimum and the maximum values of the bar //pub fn set_range(&mut self, min: i16, max: i16) -> LvResult<()> { // unsafe { diff --git a/lvgl/src/widgets/keyboard.rs b/lvgl/src/widgets/keyboard.rs index 76a40b9b..da1f5669 100644 --- a/lvgl/src/widgets/keyboard.rs +++ b/lvgl/src/widgets/keyboard.rs @@ -2,7 +2,7 @@ use crate::widgets::{Keyboard, Textarea}; use crate::LvResult; use crate::NativeObject; -impl Keyboard { +impl Keyboard<'_> { /// Associates a given `Textarea` to the keyboard. pub fn set_textarea(&mut self, textarea: &mut Textarea) -> LvResult<()> { unsafe { diff --git a/lvgl/src/widgets/label.rs b/lvgl/src/widgets/label.rs index b392050f..1ff3363e 100644 --- a/lvgl/src/widgets/label.rs +++ b/lvgl/src/widgets/label.rs @@ -8,7 +8,7 @@ mod alloc_imp { use cstr_core::CString; //use core::convert::TryFrom; - impl> From for Label { + impl> From for Label<'_> { fn from(text: S) -> Self { // text.try_into().unwrap() let text_cstr = CString::new(text.as_ref()).unwrap(); @@ -31,13 +31,11 @@ mod alloc_imp { // } } -impl Label { +impl Label<'_> { pub fn set_long_mode(&mut self, long_mode: LabelLongMode) -> LvResult<()> { unsafe { - Ok(lvgl_sys::lv_label_set_long_mode( - self.raw()?.as_mut(), - long_mode.into(), - )) + lvgl_sys::lv_label_set_long_mode(self.raw()?.as_mut(), long_mode.into()); + Ok(()) } } diff --git a/lvgl/src/widgets/slider.rs b/lvgl/src/widgets/slider.rs index 3d18ec88..bb8d0dda 100644 --- a/lvgl/src/widgets/slider.rs +++ b/lvgl/src/widgets/slider.rs @@ -2,7 +2,7 @@ use crate::lv_core::obj::NativeObject; use crate::widgets::Slider; use crate::{AnimationState, LvResult}; -impl Slider { +impl Slider<'_> { /// Set a new value on the slider pub fn set_value(&self, value: i32, anim: AnimationState) -> LvResult<()> { unsafe { lvgl_sys::lv_bar_set_value(self.core.raw()?.as_ptr(), value, anim.into()) } diff --git a/lvgl/src/widgets/table.rs b/lvgl/src/widgets/table.rs index a5a859f5..28947888 100644 --- a/lvgl/src/widgets/table.rs +++ b/lvgl/src/widgets/table.rs @@ -3,7 +3,7 @@ use crate::widgets::Table; use crate::LvResult; use core::mem::MaybeUninit; -impl Table { +impl Table<'_> { /// Sets the column width. Row height cannot be set manually and is /// calculated by LVGL based on styling parameters. pub fn set_col_width(&mut self, column: u16, width: i16) -> LvResult<()> {