Skip to content

Commit

Permalink
Add rust guidelines on module READMEs (#7847)
Browse files Browse the repository at this point in the history
  • Loading branch information
heaths authored Aug 9, 2024
1 parent 8f0f9ea commit 3c1eff3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/rust/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,22 @@ pub struct Secret {

This will impact line numbers, so you should only export APIs publicly from `lib.rs`.

{% include requirement/MAY id="rust-documentation-module-readme" %} include a separate `README.md` for a module as module documentation e.g., for module `http` defined in `http/mod.rs`:

```rust
#![doc = include_str!("README.md")]`
```

This would include the contents of `http/README.md`, which would render documentation for developers browing in the GitHub web UI, as well as compile and potentially run any tests you have defined as examples in the `README.md` e.g.,

````markdown
This is how you would construct a client:

```rust no_run
let client = SecretClient::new(...);
```
````

{% include requirement/MUST id="rust-documentation-parameters" %} document all parameters. Prior to [conventional doc comment markdown headers][rust-lang-rustdoc-headings], declare an `Arguments` heading as needed (not needed for `&self`):

```rust
Expand Down

0 comments on commit 3c1eff3

Please sign in to comment.