Skip to main content

Timer

Struct Timer 

Source
pub struct Timer { /* private fields */ }
Expand description

RAII wrapper for LVGL’s built-in timer.

LVGL timers fire from inside lvgl::handler() while the LVGL lock is already held, so callbacks must NOT call lock again — the mutex is not reentrant and you will deadlock. Prefer Timer over ove::Timer for UI-update ticks that only touch LVGL state.

Dropping the Timer deletes the underlying lv_timer_t.

Implementations§

Source§

impl Timer

Source

pub fn new(cb: lv_timer_cb_t, period_ms: u32, user_data: *mut c_void) -> Self

Create and start an LVGL timer.

§Safety

cb must be an extern "C" fn(*mut lv_timer_t) and user_data must remain valid until the timer is dropped or its repeat count reaches zero.

Source

pub fn as_raw(&self) -> *mut lv_timer_t

Returns the raw lv_timer_t * for FFI interop.

Source

pub fn period(&self, ms: u32) -> &Self

Fluent: update the period in milliseconds.

Source

pub fn pause(&self) -> &Self

Fluent: pause the timer (can be resumed).

Source

pub fn resume(&self) -> &Self

Fluent: resume a paused timer.

Source

pub fn repeat_count(&self, count: i32) -> &Self

Fluent: set the number of times the timer fires; -1 for infinite.

Source

pub fn reset(&self) -> &Self

Fluent: reset the internal elapsed-time counter.

Source

pub fn ready(&self) -> &Self

Fluent: make the timer ready to fire on the next handler pass.

Source§

impl Timer

Source

pub fn new_fn(callback: fn(), period_ms: u32) -> Self

Create an LVGL timer with a safe fn() callback.

The function pointer is smuggled through lv_timer_t::user_data; an internal trampoline calls it with no arguments.

Trait Implementations§

Source§

impl Drop for Timer

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for Timer

Source§

impl Sync for Timer

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.