File: README.md

package info (click to toggle)
rust-timer 0.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 116 kB
  • sloc: makefile: 4
file content (22 lines) | stat: -rw-r--r-- 503 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Timer

[![Build Status](https://api.travis-ci.org/Yoric/timer.rs.svg?branch=master)](https://travis-ci.org/Yoric/timer.rs)

Simple implementation of a Timer in and for Rust.

# Example
```rust
extern crate timer;
extern crate chrono;
use std::sync::mpsc::channel;

let timer = timer::Timer::new();
let (tx, rx) = channel();

timer.schedule_with_delay(chrono::Duration::seconds(3), move || {
  tx.send(()).unwrap();
});

rx.recv().unwrap();
println!("This code has been executed after 3 seconds");
```