esp-hal icon indicating copy to clipboard operation
esp-hal copied to clipboard

Generated documentation should include feature-gated APIs

Open bugadani opened this issue 2 years ago • 1 comments

the S3 docs for example don't indicate that there is a #[main] macro (or a whole embassy support module) provided by the crate.

bugadani avatar Dec 03 '23 09:12 bugadani

Probably not going to do this for the upcoming releases (hopefully coming this week), but will get it done for the next round. Would like to see #976 either merged or closed before I do any work here, as that will change things a fair bit.

jessebraham avatar Dec 11 '23 13:12 jessebraham

At least the main macro has been moved to esp-hal-embassy now, and we do enable the ci feature when building documentation for esp-hal, so I believe this issue can be closed. If there are any APIs which are still not present in the documentation please feel free to re-open this issue, or to open a new one.

jessebraham avatar Jul 31 '24 01:07 jessebraham

I agree this is done.

I wonder if we should have #![feature(doc_auto_cfg)] - the downside is that we have a lot of cfgs for chip-specific things so we end up with something like this, then:

image

I guess this might be more confusing to users than it helps

Ah ok ... found something.

We could have #![feature(doc_cfg)] and for the feature-gated items we could do something like this:

#[doc(cfg(feature = "async"))]
#[cfg(feature = "async")]
pub mod asynch {
...
}

But certainly, another issue - do we have such an issue (can't find it) or should I create a new one. Probably we should also say something about that in the HAL-developer docs

bjoernQ avatar Jul 31 '24 05:07 bjoernQ

We could have #![feature(doc_cfg)] and for the feature-gated items we could do something like this:

#[doc(cfg(feature = "async"))]
#[cfg(feature = "async")]
pub mod asynch {
...
}

But certainly, another issue - do we have such an issue (can't find it) or should I create a new one. Probably we should also say something about that in the HAL-developer docs

There's already a task in the documentation improvements issue for this, it just never got its own issue opened.

jessebraham avatar Jul 31 '24 13:07 jessebraham