Skip to main content

TimerParam

Type Alias TimerParam 

Source
pub type TimerParam = Arc<dyn Any + Send + Sync>;
Expand description

Type-erased parameter for timer callbacks.

Allows passing arbitrary data to timer callback functions in a type-safe manner. The parameter is wrapped in an Arc for safe sharing and can be downcast to its original type.

§Thread Safety

The inner type must implement Any + Send + Sync since timer callbacks execute in the timer service task context.

§Examples

use std::sync::Arc;
use osal_rs::traits::TimerParam;

// Create a parameter
let count: TimerParam = Arc::new(0u32);

// In timer callback, downcast to access
if let Some(value) = param.downcast_ref::<u32>() {
    println!("Count: {}", value);
}

Aliased Type§

pub struct TimerParam { /* private fields */ }