-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce9b286
commit 43ccd5e
Showing
4 changed files
with
320 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
name = "async_await" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
[dependencies] | ||
trpl = { path = "../../../packages/trpl" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
fn main() { | ||
trpl::block_on(async { | ||
let iter_a = [slow("a1", 100), slow("a2", 250), slow("a3", 100)]; | ||
let stream_a = trpl::stream_from_iter(iter_a); | ||
|
||
let iter_b = [slow("b1", 100), slow("b2", 250), slow("b3", 100)]; | ||
let stream_b = trpl::stream_from_iter(iter_b); | ||
}) | ||
} | ||
|
||
fn slow(name: &str, ms: u64) -> impl Fn() + '_ { | ||
use std::{thread, time::Duration}; | ||
|
||
move || { | ||
thread::sleep(Duration::from_millis(ms)); | ||
println!("'{name}' ran for {ms}ms"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters