Skip to content

Commit cae2aae

Browse files
committed
reduce readme
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
1 parent f3d1d77 commit cae2aae

File tree

1 file changed

+0
-52
lines changed

1 file changed

+0
-52
lines changed

README.md

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -7,58 +7,6 @@
77
A library for working with timers, timeouts, and intervals with the `futures`
88
crate.
99

10-
```toml
11-
# Cargo.toml
12-
[dependencies]
13-
futures-timer = "0.3"
14-
```
15-
16-
An example of using a `Delay` is:
17-
18-
```rust
19-
use std::time::Duration;
20-
21-
use futures::prelude::*;
22-
use futures_timer::Delay;
23-
24-
async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
25-
Delay::new(Duration::from_secs(3))
26-
.map(|()| println!("printed after three seconds"))
27-
.await?;
28-
}
29-
```
30-
31-
And using an `Interval`:
32-
33-
```rust
34-
use std::time::Duration;
35-
36-
use futures::prelude::*;
37-
use futures_timer::Interval;
38-
39-
#[runtime::main]
40-
async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
41-
Interval::new(Duration::from_secs(4))
42-
.take(4)
43-
.for_each(|()| Ok(println!("printed after three seconds")))
44-
.await?;
45-
}
46-
```
47-
48-
Or timing out a future
49-
50-
```rust
51-
use std::time::Duration;
52-
53-
use futures_timer::FutureExt;
54-
55-
async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
56-
// create a future that will take at most 3 seconds to resolve
57-
let future = long_running_future()
58-
.timeout(Duration::from_secs(3));
59-
}
60-
```
61-
6210
# License
6311

6412
This project is licensed under either of

0 commit comments

Comments
 (0)