Skip to content

Commit

Permalink
Add instructions for flowgraph to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mre committed Feb 15, 2019
1 parent 330f049 commit 8e0c67f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
42 changes: 35 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,40 @@ cargo inspect --diff examples/range.rs,examples/range_inclusive.rs --plain

```
USAGE:
cargo inspect [OPTIONS] <INPUT_FILE>
cargo inspect [FLAGS] [OPTIONS] [INPUT_FILE]
FLAGS:
-h, --help Prints help information
--plain Don't highlight output
-V, --version Prints version information
-v, --verbose Print the original code as a comment above the desugared code
-h, --help
Prints help information
--list-themes
Should we list all pretty printer themes?
--plain
Don't highlight output
-V, --version
Prints version information
-v, --verbose
Print the original code as a comment above the desugared code
OPTIONS:
--unpretty <unpretty> rustc "unpretty" parameters [default: hir]
--theme <THEME>
Specify a theme override for the pretty printer
--diff <files>
Diff input files
--unpretty <unpretty>
rustc "unpretty" parameters
*Note*: For `--unpretty=flowgraph=[symbol]` you need to have `dot` on your PATH. [default: hir]
ARGS:
<INPUT_FILE> Input file
<INPUT_FILE>
Input file
```

## Background
Expand Down Expand Up @@ -129,6 +150,13 @@ cargo inspect examples/if_let.rs --theme GitHub

![Please run the command to reproduce the desugared output](assets/if-let-white.png)

Oh, and if you have [`graphviz`](https://graphviz.gitlab.io/download/) installed, you can also print a pretty flowgraph from your code:

```
cargo inspect --unpretty=flowgraph=main examples/if_let.rs
```

![Please run the command to reproduce the desugared output](assets/if-let-flowgraph.png)

### More examples

Expand Down
Binary file added assets/if-let-flowgraph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8e0c67f

Please sign in to comment.