mirror of
https://github.com/async-rs/async-std.git
synced 2025-04-23 16:56:46 +00:00
add logging and print file examples
This commit is contained in:
parent
25185da76d
commit
ac9d0df7c2
1 changed files with 28 additions and 8 deletions
|
@ -1,19 +1,17 @@
|
||||||
# `async-std` Examples
|
# `async-std` Examples
|
||||||
|
|
||||||
This directory contains example code that makes use of `async-std`.
|
This directory contains example code that makes use of `async-std`, each of which can be run from the command line.
|
||||||
|
|
||||||
Each example can be run from the command line.
|
## Examples
|
||||||
|
|
||||||
For example, [Hello World][hello-world] can be run by running the following:
|
|
||||||
|
|
||||||
```
|
|
||||||
cargo run --example hello-world
|
|
||||||
```
|
|
||||||
|
|
||||||
- [Hello World][hello-world]
|
- [Hello World][hello-world]
|
||||||
|
|
||||||
Spawns a task that says hello.
|
Spawns a task that says hello.
|
||||||
|
|
||||||
|
```
|
||||||
|
cargo run --example hello-world
|
||||||
|
```
|
||||||
|
|
||||||
- [Line Count][line-count]
|
- [Line Count][line-count]
|
||||||
|
|
||||||
Counts the number of lines in a file given as an argument.
|
Counts the number of lines in a file given as an argument.
|
||||||
|
@ -26,6 +24,28 @@ cargo run --example line-count -- ./Cargo.toml
|
||||||
|
|
||||||
Lists files in a directory given as an argument.
|
Lists files in a directory given as an argument.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
cargo run --example list-dir -- .
|
||||||
|
```
|
||||||
|
|
||||||
|
- [Logging][logging]
|
||||||
|
|
||||||
|
Prints the runtime's execution log on the standard output.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
cargo run --example logging
|
||||||
|
```
|
||||||
|
|
||||||
|
- [Print File][print-file]
|
||||||
|
|
||||||
|
Prints a file given as an argument to stdout.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
cargo run --example print-file ./Cargo.toml
|
||||||
|
```
|
||||||
|
|
||||||
[hello-world]: https://github.com/async-rs/async-std/blob/master/examples/hello-world.rs
|
[hello-world]: https://github.com/async-rs/async-std/blob/master/examples/hello-world.rs
|
||||||
[line-count]: https://github.com/async-rs/async-std/blob/master/examples/line-count.rs
|
[line-count]: https://github.com/async-rs/async-std/blob/master/examples/line-count.rs
|
||||||
[list-dir]: https://github.com/async-rs/async-std/blob/master/examples/list-dir.rs
|
[list-dir]: https://github.com/async-rs/async-std/blob/master/examples/list-dir.rs
|
||||||
|
[logging]: https://github.com/async-rs/async-std/blob/master/examples/logging.rs
|
||||||
|
[print-file]: https://github.com/async-rs/async-std/blob/master/examples/print-file.rs
|
||||||
|
|
Loading…
Reference in a new issue