Rustdoc and multiple public impl blocks

I find it convenient to split implementation of public methods into several modules, so that I don't have a huge file if there are a lot of methods with complicated implementations.

However, rustdoc displays it in an unpleasant way, for instance: UBig.

All the impl blocks are shown separately, even though users shouldn't care about this implementation detail. Plus, all the blocks are collapsed, so links to methods don't work.

Is there a better way to write this code? I could move all public methods to one file and have them delegate to non-public methods in separate modules, but this adds an extra indirection that seems unnatural.

1 Like

Unfortunately, I don’t think there’s currently any way besides… do as the standard library does and don’t fear the ~3500 lines source files :sweat_smile: .


Well, at least the collapsed blocks and not-working-links to methods is a separate problem that has since been fixed. It’s only present on UBig because nightly rustdoc had that bug at the time its documentation was built.

1 Like

Each impl block can have it's own documentation to for example indicate low-level api's or platform specific api's. This won't work if you merge them into a single block.

I would say: don't merge in those cases. Merge if there is no extra information to show on separate blocks.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.