From ac9d0df7c2f555e2356da0b5e57b9d4df53bb3be Mon Sep 17 00:00:00 2001 From: Kevin Donahue Date: Wed, 25 Sep 2019 20:21:59 -0400 Subject: [PATCH] add logging and print file examples --- examples/README.md | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/examples/README.md b/examples/README.md index c5c0d57..c949453 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,19 +1,17 @@ # `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: +- [Hello World][hello-world] + +Spawns a task that says hello. ``` cargo run --example hello-world ``` -- [Hello World][hello-world] - -Spawns a task that says hello. - - [Line Count][line-count] 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. +```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 [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 +[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