Skip to content

Commit 8e65dbd

Browse files
committed
More small updates to the README
1 parent a958a82 commit 8e65dbd

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
[![Cargo](https://img.shields.io/crates/v/async-io-mini.svg)](https://crates.io/crates/async-io-mini)
66
[![Documentation](https://docs.rs/async-io/badge.svg)](https://docs.rs/async-io-mini)
77

8-
Async I/O. **EXPERIMENTAL!!**
8+
Async I/O and timers. **Experimental**
99

10-
This crate is an **experimental** fork of the splendid [`async-io`](https://github.com/smol-rs/async-io) crate targetting MCUs and ESP-IDF in particular.
10+
This crate is an experimental fork of the splendid [`async-io`](https://github.com/smol-rs/async-io) crate targetting MCUs and ESP-IDF in particular.
1111

1212
## How to use?
1313

@@ -71,15 +71,19 @@ As per above, the `Timer` type is a wrapper around the functionality provided by
7171
Connect to `example.com:80`.
7272

7373
```rust
74-
use async_io_mini::Async;
74+
use async_io_mini::{Async, Timer};
7575
use futures_lite::{future::FutureExt, io};
7676

7777
use std::net::{TcpStream, ToSocketAddrs};
7878
use std::time::Duration;
7979

8080
let addr = "example.com:80".to_socket_addrs()?.next().unwrap();
8181

82-
let stream = Async::<TcpStream>::connect(addr).await?;
82+
let stream = Async::<TcpStream>::connect(addr).or(async {
83+
Timer::after(Duration::from_secs(10)).await;
84+
Err(io::ErrorKind::TimedOut.into())
85+
})
86+
.await?;
8387
```
8488

8589
## License

0 commit comments

Comments
 (0)