Should documentation examples use multiple functions/traits?

I was reading the documentation for std::io::BufReader ( BufReader in std::io - Rust ). My problem is this example is so short it doesn't really show how to pass a BufReader to a function. The type is never actually given explictly (there is a magical "R", which is never given), so I wasn't clear how to actually pass it around.

I eventually found a stackoverflow answer which talks about BufRead, although then I was later confused that I couldn't find BufWrite.

I was going to make a github issue, and maybe even try a PR, but I wondered if there should be more discussion first about the right way to tackle these things.

I think if you can come up with a good example of how it interacts with parameters and BufRead, it would probably be accepted in std.

1 Like

I would love PRs with more examples, generally.

Issues aren't necessarily required; discussion can happen in PRs too.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.