File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -467,3 +467,36 @@ $ rustdoc src/lib.rs -Z unstable-options --runtool valgrind
467
467
```
468
468
469
469
Another use case would be to run a test inside an emulator, or through a Virtual Machine.
470
+
471
+ ### ` --show-coverage ` : get statistics about code documentation coverage
472
+
473
+ This option allows you to get a nice overview over your code documentation coverage, including both
474
+ doc-comments and code examples in the doc-comments. Example:
475
+
476
+ ``` bash
477
+ $ rustdoc src/lib.rs -Z unstable-options --show-coverage
478
+ +-------------------------------------+------------+------------+------------+------------+
479
+ | File | Documented | Percentage | Examples | Percentage |
480
+ +-------------------------------------+------------+------------+------------+------------+
481
+ | lib.rs | 4 | 100.0% | 1 | 25.0% |
482
+ +-------------------------------------+------------+------------+------------+------------+
483
+ | Total | 4 | 100.0% | 1 | 25.0% |
484
+ +-------------------------------------+------------+------------+------------+------------+
485
+ ```
486
+
487
+ You can also use this option with the ` --output-format ` one:
488
+
489
+ ``` bash
490
+ $ rustdoc src/lib.rs -Z unstable-options --show-coverage --output-format json
491
+ {" lib.rs" :{" total" :4," with_docs" :4," total_examples" :4," with_examples" :1}}
492
+ ```
493
+
494
+ To be noted: the computation of code examples follows these rules:
495
+
496
+ 1 . These items aren't accounted by default:
497
+ * struct/union field
498
+ * enum variant
499
+ * constant
500
+ * static
501
+ * typedef
502
+ 2 . If one of the previously listed items has a code example, then it'll be counted.
You can’t perform that action at this time.
0 commit comments