#定时器 #周期 #回调

bin+lib periodic_timer

简单的 Rust 周期定时器实现

2 个版本

0.1.1 2022年7月30日
0.1.0 2022年7月30日

#21 in #周期

MIT/Apache

8KB
144

周期定时器

periodic_timer 是一个简单的 Rust 周期定时器实现。

用法

use periodic_timer::Timer;

// Prepare callback function to be periodically executed
let callback = || println!("hello timer!");

// Create new timer
let timer = Timer::new(1.0, callback);

// Start timer
timer.start();

lib.rs:

简单定时器

periodic_timer 是一个简单的周期定时器实现。

用法

use periodic_timer::Timer;

// Prepare callback function to be periodically executed
let callback = || println!("hello timer!");

// Create new timer
let timer = Timer::new(1.0, callback);

// Start timer
timer.start();

依赖项

~0–7.5MB
~40K SLoC