rust-lang / rust-lang/docs.rs

Document a binary?

Open
#238 21 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

E-medium mentor P-medium S-needs-design
Dominant language
Rust
Stars
1.2k
Forks
232
Avg merge
11h 35m
Merged PRs (30d)
60

Description

edit(@jyn514): Mentoring instructions for this issue are here: https://github.com/rust-lang/docs.rs/issues/238#issuecomment-724579558

My crate has a macro that defines structs, and I want the docs to include an example of one of those generated structs. My solution was to write a binary, src/bin/example.rs, that invokes the macro.

This works great when I run cargo doc. I see example listed in the crates sidebar, and it contains docs for the generated struct. However, it doesn't show up in docs.rs.

I tried adding this to Cargo.toml, but it didn't help:

[[bin]]
name = "example"
doc = true

Is there some magical argument I can pass using [package.metadata.docs.rs] that will make it document the binary? Any other suggestions?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior with src/bin/example.rs and the shown Cargo.toml settings, then inspect how docs.rs handles crate targets and [package.metadata.docs.rs]. Confirm whether binary documentation can be supported or whether the issue needs a documented limitation; done means the expected behavior and configuration are clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.