Mastodon Feed: Post

Mastodon Feed

Reblogged by rust@octodon.social ("Rust tips"):

valentinegb@hachyderm.io ("Valentine Briese :transuwu:") wrote:

Little bit of a trick I discovered for documenting fields which are on multiple structures:

```rust
macro_rules! extensions_doc {
() => {
r#"The extensions properties are implemented as patterned fields that are always prefixed by `"x-"`."#
};
}

pub struct Info {
// ...
#[doc = extensions_doc!()]
pub extensions: HashMap<String, Value>,
}
```

#Rust #RustLang #OpenAPI