sway icon indicating copy to clipboard operation
sway copied to clipboard

Include primitive types in forc-doc generated docs

Open sdankel opened this issue 1 year ago • 1 comments

forc-doc generates a static documentation website from sway code (specifically, from the sway compiler output).

Sway primitives are, however, written in Rust. We need a way for forc-doc to generate docs for the primitive types and include them as a submodule in the sway-lib-std docs. Some possible solutions:

rust-doc

Maybe we can use rust doc just for the std library for those files and splice them into the forc doc result somehow. rust-doc wouldn’t show usages or trait implementations though, since those are written in sway.

Generate primitive definitions in sway

Maybe there’s a way to generate sway code from the primitive type definitions in rust. If we could generate valid sway code and include it in the lib-std package, forc-doc would generate docs for it.

Custom plugin for generating primitive docs

We could write a custom plugin like forc-doc-primitives that generates docs for the primitives.

Open to other ideas/suggestions!

sdankel avatar May 06 '24 17:05 sdankel

This will be mostly solved by generating docs for the primitive type impls: https://github.com/FuelLabs/sway/issues/5957

Closing this as a duplicate.

sdankel avatar May 08 '24 18:05 sdankel