Skip to content

Commit

Permalink
Release 0.10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
udoprog committed Aug 3, 2024
1 parent a6eeca4 commit c539d49
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "unicycle"
version = "0.10.1"
version = "0.10.2"
authors = ["John-John Tedro <udoprog@tedro.se>"]
edition = "2021"
rust-version = "1.68"
Expand Down
46 changes: 21 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,49 +37,45 @@ should consider putting it in production.
## Examples

```rust
use tokio::time;
use std::time::Duration;
use unicycle::FuturesUnordered;

#[tokio::main]
async fn main() {
let mut futures = FuturesUnordered::new();
use tokio::time;
use unicycle::FuturesUnordered;

futures.push(time::sleep(Duration::from_secs(2)));
futures.push(time::sleep(Duration::from_secs(3)));
futures.push(time::sleep(Duration::from_secs(1)));
let mut futures = FuturesUnordered::new();

while let Some(_) = futures.next().await {
println!("tick");
}
futures.push(time::sleep(Duration::from_secs(2)));
futures.push(time::sleep(Duration::from_secs(3)));
futures.push(time::sleep(Duration::from_secs(1)));

println!("done!");
while let Some(_) = futures.next().await {
println!("tick");
}

println!("done!");
```

[Unordered] types can be created from iterators:

```rust
use tokio::time;
use std::time::Duration;
use unicycle::FuturesUnordered;

#[tokio::main]
async fn main() {
let mut futures = Vec::new();
use tokio::time;
use unicycle::FuturesUnordered;

futures.push(time::sleep(Duration::from_secs(2)));
futures.push(time::sleep(Duration::from_secs(3)));
futures.push(time::sleep(Duration::from_secs(1)));
let mut futures = Vec::new();

let mut futures = futures.into_iter().collect::<FuturesUnordered<_>>();
futures.push(time::sleep(Duration::from_secs(2)));
futures.push(time::sleep(Duration::from_secs(3)));
futures.push(time::sleep(Duration::from_secs(1)));

while let Some(_) = futures.next().await {
println!("tick");
}
let mut futures = futures.into_iter().collect::<FuturesUnordered<_>>();

println!("done!");
while let Some(_) = futures.next().await {
println!("tick");
}

println!("done!");
```

<br>
Expand Down

0 comments on commit c539d49

Please # to comment.