11# ` async-std ` Examples
22
3- This directory contains example code that makes use of ` async-std ` .
3+ This directory contains example code that makes use of ` async-std ` , each of which can be run from the command line .
44
5- Each example can be run from the command line.
5+ ## Examples
66
7- For example, [ Hello World] [ hello-world ] can be run by running the following:
7+ - [ Hello World] [ hello-world ]
8+
9+ Spawns a task that says hello.
810
911```
1012cargo run --example hello-world
1113```
1214
13- - [ Hello World] [ hello-world ]
14-
15- Spawns a task that says hello.
16-
1715- [ Line Count] [ line-count ]
1816
1917Counts the number of lines in a file given as an argument.
@@ -26,6 +24,28 @@ cargo run --example line-count -- ./Cargo.toml
2624
2725Lists files in a directory given as an argument.
2826
27+ ``` shell
28+ cargo run --example list-dir -- .
29+ ```
30+
31+ - [ Logging] [ logging ]
32+
33+ Prints the runtime's execution log on the standard output.
34+
35+ ``` shell
36+ cargo run --example logging
37+ ```
38+
39+ - [ Print File] [ print-file ]
40+
41+ Prints a file given as an argument to stdout.
42+
43+ ``` shell
44+ cargo run --example print-file ./Cargo.toml
45+ ```
46+
2947[ hello-world ] : https://github.com/async-rs/async-std/blob/master/examples/hello-world.rs
3048[ line-count ] : https://github.com/async-rs/async-std/blob/master/examples/line-count.rs
3149[ list-dir ] : https://github.com/async-rs/async-std/blob/master/examples/list-dir.rs
50+ [ logging ] : https://github.com/async-rs/async-std/blob/master/examples/logging.rs
51+ [ print-file ] : https://github.com/async-rs/async-std/blob/master/examples/print-file.rs
0 commit comments