Document a binary? · Issue #238 · rust-lang/docs.rs (original) (raw)

edit(@jyn514): Mentoring instructions for this issue are here: #238 (comment)

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?