timer.rs:Rust计时器的简单实现

时间:2021-05-25 16:03:16
【文件属性】:
文件名称:timer.rs:Rust计时器的简单实现
文件大小:13KB
文件格式:ZIP
更新时间:2021-05-25 16:03:16
Rust 计时器 在Rust中以及针对Rust的Timer的简单实现。 例子 extern crate timer; extern crate chrono; use std :: sync :: mpsc :: channel; let timer = timer :: Timer :: new (); let (tx, rx) = channel (); let _guard = timer. schedule_with_delay (chrono :: Duration :: seconds ( 3 ), move || { tx. send (()). unwrap (); }); rx. recv (). unwrap (); println! ( "This code has been executed after 3 seconds" );
【文件预览】:
timer.rs-master
----.travis.yml(53B)
----LICENSE(16KB)
----src()
--------lib.rs(30KB)
----Cargo.toml(454B)
----README.md(516B)

网友评论