mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
327 B
17 lines
327 B
9 months ago
|
extern crate trpl; // required for mdbook test
|
||
|
|
||
|
use std::{thread, time::Duration};
|
||
|
|
||
|
fn main() {
|
||
|
trpl::run(async {
|
||
|
// We will call `slow` here later
|
||
|
});
|
||
|
}
|
||
|
|
||
|
// ANCHOR: slow
|
||
|
fn slow(name: &str, ms: u64) {
|
||
|
thread::sleep(Duration::from_millis(ms));
|
||
|
println!("'{name}' ran for {ms}ms");
|
||
|
}
|
||
|
// ANCHOR_END: slow
|