Docs.rs does not document struct methods

Has anyone got an idea how to fix that?

The structure is something like this:

I have module foo that's behind a feature gate.

lib.rs

#[cfg(feature = "feature")]
pub mod foo

foo.rs

struct Bar {}

impl Bar {
   do_bar(&self) {}
}

This documents the struct Bar, but not its methods.

In the real world this happens with this CsvReader struct.

P.S. I have this snippet in my Cargo.toml

[package.metadata.docs.rs]
all-features = true
# defines the configuration attribute `docsrs`
rustdoc-args = ["--cfg", "docsrs"]

I can see the methods documents from the docs.rs link.

Yes, but if you click on them, you don't see them documented. No docstrings, no types, etc.

I mean they're well documented with doc comments and types.

1 Like

The implementation blocks were collapsed initially for me - I had to click the [+] to see what you're seeing.

Wow.. Thanks you all. Indeed, collapsed. :see_no_evil:

Note that this generally isn't necessary, as impl blocks are open be default. There was a temporary regression on nightly that has already been fixed.

1 Like